Sha256: ee3576338332114bc33995d6ba105cc5a31693acbf13a751b4432c481e866c12
Contents?: true
Size: 838 Bytes
Versions: 6
Compression:
Stored size: 838 Bytes
Contents
// Visibility toggle for items in an exhibit, based on Blacklight's bookmark toggle // See: https://github.com/projectblacklight/blacklight/blob/main/app/javascript/blacklight/bookmark_toggle.js import CheckboxSubmit from 'spotlight/admin/checkbox_submit' const VisibilityToggle = (e) => { if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) { const form = e.target.closest('form') if (form) { if (!Blacklight.BookmarkToggle) new CheckboxSubmit(form).clicked(e) // Add/remove the "private" label to the document row when visibility is toggled const docRow = form.closest('tr') if (docRow) docRow.classList.toggle('blacklight-private') } } } VisibilityToggle.selector = 'form.visibility-toggle' document.addEventListener('click', VisibilityToggle) export default VisibilityToggle
Version data entries
6 entries across 6 versions & 1 rubygems