Sha256: 771571c09e6b6b6044104601a18c637c0842739e2e9d6338f0e3f32e03958e14
Contents?: true
Size: 1.75 KB
Versions: 45
Compression:
Stored size: 1.75 KB
Contents
import CollectionUtilities from 'hyrax/collections_utils'; export default class CollectionsV2 { constructor() { this.collectionUtilities = new CollectionUtilities(); this.setupAddSharingHandler(); this.sharingAddButtonDisabler(); } /** * Set up the handler for adding groups or users via AJAX POSTS at the following location: * Collection > Edit > Sharing tab; or * Collection Types > Edit > Participants tab * @return {void} */ setupAddSharingHandler() { const { addParticipants } = this.collectionUtilities; const wrapEl = '.form-add-sharing-wrapper'; $('#participants') .find('.edit-collection-add-sharing-button') .on('click', { wrapEl, urlFn: (e) => { const $wrapEl = $(e.target).parents(wrapEl); return '/dashboard/collections/' + $wrapEl.data('id') + '/permission_template?locale=en'; } }, addParticipants.handleAddParticipants.bind(addParticipants)); } /** * Set up enabling/disabling "Add" button for adding groups and/or users in * Edit Collection > Sharing tab * @return {void} */ sharingAddButtonDisabler() { const { addParticipantsInputValidator } = this.collectionUtilities; // Selector for the button to enable/disable const buttonSelector = '.edit-collection-add-sharing-button'; const inputsWrapper = '.form-add-sharing-wrapper'; $('#participants') .find(inputsWrapper) .on( 'change', // custom data we need passed into the event handler { buttonSelector: '.edit-collection-add-sharing-button', inputsWrapper }, addParticipantsInputValidator.handleWrapperContentsChange.bind( addParticipantsInputValidator ) ); } }
Version data entries
45 entries across 45 versions & 1 rubygems