-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1260 from samvera/collection_thumbnails
Add thumbnails to collections
- Loading branch information
Showing
34 changed files
with
359 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 15 additions & 29 deletions
44
app/assets/javascripts/hyrax/admin/admin_set_controls.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,19 @@ | ||
export default class { | ||
constructor(elem) { | ||
this.loadThumbnailOptions(elem) | ||
// The editor for the AdminSets | ||
// Add search for user/group to the edit an admin set's participants page | ||
// Add search for thumbnail to the edit descriptions | ||
import Visibility from 'hyrax/admin/admin_set/visibility' | ||
import Participants from 'hyrax/admin/admin_set/participants' | ||
import ThumbnailSelect from 'hyrax/thumbnail_select' | ||
|
||
let Participants = require('hyrax/admin/admin_set/participants'); | ||
let participants = new Participants(elem.find('#participants')) | ||
participants.setup(); | ||
export default class { | ||
constructor(elem) { | ||
let url = window.location.pathname.replace('edit', 'files') | ||
this.thumbnailSelect = new ThumbnailSelect(url, elem.find('#admin_set_thumbnail_id')) | ||
|
||
let Visibility = require('hyrax/admin/admin_set/visibility'); | ||
let visibilityTab = new Visibility(elem.find('#visibility')); | ||
visibilityTab.setup(); | ||
} | ||
let participants = new Participants(elem.find('#participants')) | ||
participants.setup(); | ||
|
||
// Dynamically load the file options into the "Thumbnail" select field. | ||
loadThumbnailOptions(elem) { | ||
let url = window.location.pathname.replace('edit', 'files') | ||
elem.find('#admin_set_thumbnail_id').select2({ | ||
ajax: { // Use the jQuery.ajax wrapper provided by Select2 | ||
url: url, | ||
dataType: "json", | ||
results: function(data, page) { | ||
return { results: data } | ||
} | ||
}, | ||
initSelection: function(element, callback) { | ||
// the input tag has a value attribute preloaded that points to a preselected repository's id | ||
// this function resolves that id attribute to an object that select2 can render | ||
// using its formatResult renderer - that way the repository name is shown preselected | ||
callback({ text: $(element).data('text') }) | ||
} | ||
}) | ||
} | ||
let visibilityTab = new Visibility(elem.find('#visibility')); | ||
visibilityTab.setup(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import ThumbnailSelect from 'hyrax/thumbnail_select' | ||
|
||
// Controls the behavior of the Collections edit form | ||
// Add search for thumbnail to the edit descriptions | ||
export default class { | ||
constructor(elem) { | ||
let url = window.location.pathname.replace('edit', 'files') | ||
let field = elem.find('#collection_thumbnail_id') | ||
this.thumbnailSelect = new ThumbnailSelect(url, field); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Dynamically load the file options into the "Thumbnail" select field. | ||
export default class { | ||
/* | ||
* @param {String} url the search endpoint | ||
* @param {jQuery} the field to add the select to | ||
*/ | ||
constructor(url, field) { | ||
this.loadThumbnailOptions(url, field) | ||
} | ||
|
||
// Dynamically load the file options into the "Thumbnail" select field. | ||
loadThumbnailOptions(url, field) { | ||
field.select2({ | ||
ajax: { // Use the jQuery.ajax wrapper provided by Select2 | ||
url: url, | ||
dataType: "json", | ||
results: function(data, page) { | ||
return { results: data } | ||
} | ||
}, | ||
initSelection: function(element, callback) { | ||
// the input tag has a value attribute preloaded that points to a preselected repository's id | ||
// this function resolves that id attribute to an object that select2 can render | ||
// using its formatResult renderer - that way the repository name is shown preselected | ||
callback({ text: $(element).data('text') }) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.