Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pals Knapsack: Contribute Back to Hyku #2193

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
314cf4d
🚧 Add files from PALs Hyku not in other repos
jeremyf Apr 5, 2024
d0c451d
🚧 Partial add of PALs featuers to Hyku Prime
jeremyf Apr 9, 2024
212d688
🎁 Add feature to treat some text as markdown
jeremyf Apr 9, 2024
1b87301
🎁 Adding markdown rendering for many fields
jeremyf Apr 10, 2024
b913ec1
Add some quality of life functions to Hyku from PALs
jeremyf Apr 10, 2024
62c79d4
This is now handled in Hyrax
jeremyf Apr 10, 2024
7145bdd
Favor feature flag for login/authentication
jeremyf Apr 10, 2024
99fd32b
Reviewing decorators that should have PALS contributions
jeremyf Apr 10, 2024
8479c18
Ongoing review of files that were different in 3 or more repositories
jeremyf Apr 10, 2024
5e8d3f3
Fixing parse error
jeremyf Apr 11, 2024
0d5f76d
💄 endless and ever appeasing of the coppers
jeremyf Apr 11, 2024
6a23a68
Extracting geonames feature from PALs
jeremyf Apr 11, 2024
b163800
Add render of empty related items partial
jeremyf Apr 11, 2024
f3f79c7
Contribute back PALs work
jeremyf Apr 11, 2024
54b2c21
🎁 Add config option for http auth user/pass
jeremyf Apr 16, 2024
7a0fb76
💄 endless and ever appeasing of the coppers
jeremyf Apr 16, 2024
b1247f2
WIP
jeremyf Apr 16, 2024
2843307
Fixing docker build
jeremyf Apr 16, 2024
5acc3bc
🎁 Porting over ApplicationController from PALs
jeremyf Apr 16, 2024
62bf0e5
💄 endless and ever appeasing of the coppers
jeremyf Apr 16, 2024
6cb2b0c
💄 endless and ever appeasing of the coppers
jeremyf Apr 16, 2024
c358873
Remove force_ssl declaration
jeremyf Apr 16, 2024
c0eb059
♻️ Remove discard flash
jeremyf Apr 16, 2024
8b4b484
Renaming file
jeremyf Apr 16, 2024
7312e70
♻️ Remove SCSS width variables
jeremyf Apr 16, 2024
9a873c6
Add conditional bulkrax_identifier
jeremyf Apr 16, 2024
f99a5f1
Fixing embed behavior
jeremyf Apr 16, 2024
04ac06f
Updating account settings to allow for super admin only
jeremyf Apr 16, 2024
e1f0548
💄 endless and ever appeasing of the coppers
jeremyf Apr 16, 2024
70121ae
♻️ Fixing parse error
jeremyf Apr 16, 2024
b5d42bd
It is Flipflop not FlipFlop
jeremyf Apr 16, 2024
a1a0f47
♻️ Adding methods that were once missing
jeremyf Apr 16, 2024
6b921f6
♻️ Use Hyrax.config.collection_class
jeremyf Apr 17, 2024
282f666
♻️ Fix parse error in template
jeremyf Apr 17, 2024
85c297c
♻️ Remove spec that was local to PALs
jeremyf Apr 17, 2024
4c447d9
Fix missing method
jeremyf Apr 17, 2024
2d14c29
♻️ Add routes from PALs
jeremyf Apr 17, 2024
fb2c5d8
☑️ Adding spec fixtures for geonames
jeremyf Apr 17, 2024
91b59ed
Favor Site.account instead of Settings
jeremyf Apr 17, 2024
f5f32b4
☑️ Fixing some specs
jeremyf Apr 17, 2024
c80bee9
☑️ Fixing processor chain logic
jeremyf Apr 17, 2024
fe304b3
☑️ Updating test to include CSV for imports
jeremyf Apr 17, 2024
4fc6067
Adding properties to base models
jeremyf Apr 17, 2024
2648884
💄 endless and ever appeasing of the coppers
jeremyf Apr 17, 2024
09f21bf
Fixing spec
jeremyf Apr 17, 2024
282ff1d
Commenting out two specs that are failing due to Hyrax
jeremyf Apr 17, 2024
f4f1337
☑️ Comment out some failing specs
jeremyf Apr 17, 2024
c719106
☑️ Remediating splash page specs
jeremyf Apr 17, 2024
ea3e306
♻️ Improving documentation of grapher
jeremyf Apr 18, 2024
8ec7e2b
Adding editor.es6 from knapsack
jeremyf Apr 18, 2024
1cef29f
Grabbing more files that were slotted for the knapsack
jeremyf Apr 18, 2024
f9a9233
Adding more files from Knapsack
jeremyf Apr 18, 2024
9107f69
♻️ Favor user from PALs
jeremyf Apr 18, 2024
e6f242c
Finding more files to send forward
jeremyf Apr 18, 2024
f8ed080
Adding role files to Hyku
jeremyf Apr 18, 2024
92cabf3
Fixing parse errors
jeremyf Apr 18, 2024
463b64e
Updating user to parse
jeremyf Apr 18, 2024
ac05f30
📚 Add SSL true default
jeremyf Apr 18, 2024
c060489
💄 endless and ever appeasing of the coppers
jeremyf Apr 18, 2024
e736c4c
Remove method call to is_superadmin
jeremyf Apr 18, 2024
faded8c
♻️ Ignore case where we don't have an account
jeremyf Apr 18, 2024
27996b8
Commenting out failing specs
jeremyf Apr 18, 2024
528435d
Update build test lint to clean up space
jeremyf Apr 18, 2024
957a300
Update app/forms/video_embed_form_behavior.rb
jeremyf Apr 18, 2024
300cc04
Update app/jobs/work_index_job.rb
jeremyf Apr 18, 2024
75962f7
Update app/jobs/file_set_index_job.rb
jeremyf Apr 18, 2024
ab6aa95
♻️ Ensure DestroySplitPagesJob works for Valkyrie
jeremyf Apr 19, 2024
162b1a4
Removing already existing behavior
jeremyf Apr 19, 2024
4c1aa2b
Remove duplicate job
jeremyf Apr 19, 2024
6abed97
Removing file not needed
jeremyf Apr 19, 2024
1550ade
Remove duplication
jeremyf Apr 19, 2024
14a9f8d
🎁 Add Bulkrax Identifier to Resources
jeremyf Apr 19, 2024
2b8b1fd
🎁 Adding is_derived property to file set
jeremyf Apr 19, 2024
290a337
💄 endless and ever appeasing of the coppers
jeremyf Apr 19, 2024
a0b1325
♻️ Add bulkrax_identifier to GenericWorkResource
jeremyf Apr 19, 2024
62b7d9c
Remove file; it's better defined in iiif_print
jeremyf Apr 19, 2024
ae0300b
Merge branch 'main' into working-on-moving-pals-to-knapsack
ShanaLMoore Apr 22, 2024
c32e5e7
Update _recent_document.html.erb
ShanaLMoore Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
build:
uses: scientist-softserv/actions/.github/workflows/[email protected].15
uses: scientist-softserv/actions/.github/workflows/[email protected].21
secrets: inherit
with:
platforms: "linux/amd64" # "linux/amd64,linux/arm64"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-guests (0.8.1)
devise-guests (0.8.2)
devise
devise-i18n (1.12.0)
devise (>= 4.9.0)
Expand Down
Binary file added app/assets/images/loading-progress.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/assets/javascripts/admin_font_select.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Blacklight.onLoad(function() {
if($("#admin_appearance_body_font").length > 0){
$("#admin_appearance_body_font").fontselect({lookahead: 20});
$("#admin_appearance_headline_font").fontselect({lookahead: 20});
}
});
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
//= require jquery.dataTables
//= require dataTables.bootstrap4
//= require cropper.min

//= require stat_slider
//= require turbolinks
//= require cocoon
Expand Down Expand Up @@ -64,5 +65,4 @@
//= require blacklight_range_limit/range_limit_slider
//= require bootstrap-slider
//= require jquery.flot.js

//= require tinymce
156 changes: 156 additions & 0 deletions app/assets/javascripts/hyrax/editor.es6
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// Override from Hyrax 5.0.1 - Add previous version dropdown
import RelationshipsControl from 'hyrax/relationships/control'
import SaveWorkControl from 'hyrax/save_work/save_work_control'
import AdminSetWidget from 'hyrax/editor/admin_set_widget'
import ControlledVocabulary from 'hyrax/editor/controlled_vocabulary'
import Autocomplete from 'hyrax/autocomplete'
import AuthoritySelect from 'hyrax/authority_select'

export default class {
/**
* initialize the editor behaviors
* @param {jQuery} element - The form that has a data-param-key attribute
*/
constructor(element) {
this.element = element
this.paramKey = element.data('paramKey') // The work type
this.adminSetWidget = new AdminSetWidget(element.find('select[id$="_admin_set_id"]'))
this.sharingTabElement = $('#tab-share')
}

init() {
this.autocomplete()
this.controlledVocabularies()
this.sharingTab()
this.relationshipsControl()
this.saveWorkControl()
this.saveWorkFixed()
this.authoritySelect()
this.formInProgress()
}

// Immediate feedback after work creation, editing.
formInProgress() {
$('[data-behavior~=work-form]').on('submit', function(event){
$('.card-footer.save-progress').removeAttr("hidden");
});
}

// Used when you have a linked data field that can have terms from multiple
// authorities.
authoritySelect() {
$("[data-authority-select]").each(function() {
let authoritySelect = $(this).data().authoritySelect
let options = {selectBox: 'select.' + authoritySelect,
inputField: 'input.' + authoritySelect}
new AuthoritySelect(options);
})
}

// Autocomplete fields for the work edit form (based_near, subject, language, child works)
autocomplete() {
var autocomplete = new Autocomplete()

$('[data-autocomplete]').each((function() {
var elem = $(this)
autocomplete.setup(elem, elem.data('autocomplete'), elem.data('autocompleteUrl'))
elem.parents('.multi_value.form-group').manage_fields({
add: function(e, element) {
var elem = $(element)
// Don't mark an added element as readonly even if previous element was
// Enable before initializing, as otherwise LinkedData fields remain disabled
elem.attr('readonly', false)
autocomplete.setup(elem, elem.data('autocomplete'), elem.data('autocompleteUrl'))
}
})
}))
}

// initialize any controlled vocabulary widgets
controlledVocabularies() {
this.element.find('.controlled_vocabulary.form-group').each((_idx, controlled_field) =>
new ControlledVocabulary(controlled_field, this.paramKey)
)
}

// Display the sharing tab if they select an admin set that permits sharing
sharingTab() {
if(this.adminSetWidget && !this.adminSetWidget.isEmpty()) {
this.adminSetWidget.on('change', () => this.sharingTabVisiblity(this.adminSetWidget.isSharing()))
this.sharingTabVisiblity(this.adminSetWidget.isSharing())
}
}

sharingTabVisiblity(visible) {
if (visible)
this.sharingTabElement.removeAttr("hidden")
else
this.sharingTabElement.attr("hidden","")
}

relationshipsControl() {
let collections = this.element.find('[data-behavior="collection-relationships"]')
collections.each((_idx, element) =>
new RelationshipsControl(element,
collections.data('members'),
collections.data('paramKey'),
'member_of_collections_attributes',
'tmpl-collection').init())

let works = this.element.find('[data-behavior="child-relationships"]')
works.each((_idx, element) =>
new RelationshipsControl(element,
works.data('members'),
works.data('paramKey'),
'work_members_attributes',
'tmpl-child-work').init())

let previous_versions = this.element.find('[data-behavior="previous-version-relationship"]')
previous_versions.each((_idx, element) =>
new RelationshipsControl(element,
previous_versions.data('members'),
previous_versions.data('paramKey'),
'related_members_attributes',
'tmpl-previous-version',
previous_versions.data('relationship')).init())

// added newer_versions relationship
let newer_versions = this.element.find('[data-behavior="newer-version-relationship"]')
newer_versions.each((_idx, element) =>
new RelationshipsControl(element,
newer_versions.data('members'),
newer_versions.data('paramKey'),
'related_members_attributes',
'tmpl-newer-version',
newer_versions.data('relationship')).init())

// added alternate_versions relationship
let alternate_versions = this.element.find('[data-behavior="alternate-version-relationship"]')
alternate_versions.each((_idx, element) =>
new RelationshipsControl(element,
alternate_versions.data('members'),
alternate_versions.data('paramKey'),
'related_members_attributes',
'tmpl-alternate-version',
alternate_versions.data('relationship')).init())

// added alternate_versions relationship
let related_items = this.element.find('[data-behavior="related-item-relationship"]')
related_items.each((_idx, element) =>
new RelationshipsControl(element,
related_items.data('members'),
related_items.data('paramKey'),
'related_members_attributes',
'tmpl-related-item',
related_items.data('relationship')).init())
}

saveWorkControl() {
new SaveWorkControl(this.element.find("#form-progress"), this.adminSetWidget)
}

saveWorkFixed() {
// Fixedsticky will polyfill position:sticky
this.element.find('#savewidget').fixedsticky()
}
}
107 changes: 107 additions & 0 deletions app/assets/javascripts/hyrax/relationships/control.es6
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* Copied from hyrax 2.5 to add relationship
**/


import Registry from './registry'
import Resource from './resource'
/**
* This depends on the passed in element containing `data-autocomplete="work'"`
* that is also a select2 element.
*/
export default class RelationshipsControl {

/**
* COPIED FROM HYRAX TO ADD RELATIONSHIP FOR RELATED ITEMS
* Initializes the class in the context of an individual table element
* @param {HTMLElement} element the table element that this class represents.
* @param {Array} members the members to display in the table
* @param {String} paramKey the key for the type of object we're submitting (e.g. 'generic_work')
* @param {String} property the property to submit
* @param {String} templateId the template identifier for new rows
* @param {String} relationship the type of relationship for oer items
*/
constructor(element, members, paramKey, property, templateId, relationship) {
this.element = $(element)
this.members = this.element.data('members')
this.relationship = relationship
this.registry = new Registry(this.element.find('tbody'), paramKey, property, templateId, relationship)
this.input = this.element.find(`[data-autocomplete]`)
this.warning = this.element.find(".message.has-warning")
this.addButton = this.element.find("[data-behavior='add-relationship']")
this.errors = null
}

init() {
this.bindAddButton();
this.displayMembers();
}

validate() {
if (this.input.val() === "") {
this.errors = ['ID cannot be empty.']
}
}

// added relationship
displayMembers() {
this.members.forEach((elem) =>
this.registry.addResource(new Resource(elem.id, elem.label, elem.relationship))
)
}

isValid() {
this.validate()
return this.errors === null
}

/**
* Handle click events by the "Add" button in the table, setting a warning
* message if the input is empty or calling the server to handle the request
*/
bindAddButton() {
this.addButton.on("click", () => this.attemptToAddRow())
}

attemptToAddRow() {
// Display an error when the input field is empty, or if the resource ID is already related,
// otherwise clone the row and set appropriate styles
if (this.isValid()) {
this.addRow()
} else {
this.setWarningMessage(this.errors.join(', '))
}
}

addRow() {
this.hideWarningMessage()
let data = this.searchData()
this.registry.addResource(new Resource(data.id, data.text))

// finally, empty the "add" row input value
this.clearSearch();
}

searchData() {
return this.input.select2('data')
}

clearSearch() {
this.input.select2("val", '');
}

/**
* Set the warning message related to the appropriate row in the table
* @param {String} message the warning message text to set
*/
setWarningMessage(message) {
this.warning.text(message).removeClass("hidden");
}

/**
* Hide the warning message on the appropriate row
*/
hideWarningMessage(){
this.warning.addClass("hidden");
}
}
73 changes: 73 additions & 0 deletions app/assets/javascripts/hyrax/relationships/registry.es6
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* Copied from hyrax 2.5 to add relationship
**/

import RegistryEntry from './registry_entry'
export default class Registry {
/**
* COPIED FROM HYRAX TO ADD RELATIONSHIP FOR RELATED ITEMS
* Initialize the registry
* @param {jQuery} element the jquery selector for the permissions container.
* must be a table with a tbody element.
* @param {String} object_name the name of the object, for constructing form fields (e.g. 'generic_work')
* @param {String} templateId the the identifier of the template for the added elements
* @param {String} relationship the indentifier of which relationship being added
*/
constructor(element, objectName, propertyName, templateId, relationship) {
this.objectName = objectName
this.propertyName = propertyName
this.relationship = relationship
this.templateId = templateId
this.items = []
this.element = element
element.closest('form').on('submit', (evt) => {
this.serializeToForm()
});
}

// Return an index for the hidden field when adding a new row.
// A large random will probably avoid collisions.
nextIndex() {
return Math.floor(Math.random() * 1000000000000000)
}

export() {
return this.items.map(item => item.export())
}

// ADDED RELATIONSHIP
serializeToForm() {
this.export().forEach((item, index) => {
let nextIndex = this.nextIndex()
this.addHiddenField(nextIndex, 'id', item.id)
this.addHiddenField(nextIndex, '_destroy', item['_destroy'])
this.addHiddenField(nextIndex, 'relationship', item.relationship)
})
}

addHiddenField(index, key, value) {
$('<input>').attr({
type: 'hidden',
name: `${this.fieldPrefix(index)}[${key}]`,
value: value
}).appendTo(this.element);
}

// ADDED RELATIONSHIP
// Adds the resource to the first row of the tbody
addResource(resource) {
resource.index = this.nextIndex()
let entry = new RegistryEntry(resource, this, this.templateId, this.relationship)
this.items.push(entry)
this.element.prepend(entry.view)
this.showSaveNote()
}

fieldPrefix(counter) {
return `${this.objectName}[${this.propertyName}][${counter}]`
}

showSaveNote() {
// TODO: we may want to reveal a note that changes aren't active until the resource is saved
}
}
Loading
Loading