blacklight 8.4.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.esm.js +11 -9
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +11 -9
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- data/app/components/blacklight/search_context/server_item_pagination_component.html.erb +7 -3
- data/app/components/blacklight/search_context/server_item_pagination_component.rb +1 -1
- data/app/components/blacklight/skip_link_component.html.erb +1 -1
- data/app/helpers/blacklight/document_helper_behavior.rb +14 -0
- data/app/javascript/blacklight/checkbox_submit.js +5 -3
- data/app/javascript/blacklight/core.js +5 -5
- data/app/views/catalog/_show_sidebar.html.erb +1 -0
- data/app/views/catalog/show.html.erb +3 -1
- data/app/views/kaminari/blacklight/_paginator.html.erb +2 -1
- data/app/views/layouts/blacklight/base.html.erb +0 -1
- data/blacklight.gemspec +2 -2
- data/lib/blacklight/component.rb +10 -47
- data/lib/blacklight/engine.rb +6 -0
- data/lib/generators/blacklight/user_generator.rb +2 -0
- data/package.json +3 -2
- data/rollup.config.js +6 -12
- data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +12 -1
- data/spec/features/search_context_spec.rb +2 -1
- data/spec/lib/blacklight/component_spec.rb +32 -27
- data/spec/spec_helper.rb +5 -2
- data/tasks/blacklight.rake +2 -2
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3f47b9e29a5b0ab121d67527cdc2a69bbc02060100bf438f5c2bcc9d4f4f4e3
|
4
|
+
data.tar.gz: f6157e3ccc510be3a4ca02dcf560b400db9855ff63b89e9abe5f0c40cbac0cba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3309694036e4a5e75680f56e2f920cc06f5a88e4ecd5d0e2a70b068ddb5436567481efde3896eac8b23684c558c84289da58dd61d7944c0935ae3cdb53860dbb
|
7
|
+
data.tar.gz: 8fe85d16697b0314c0f75539c919c94e8ac002e3d180106ec02934b925e7fade6ff82e52a00daa39c383b0c4065556f16bac18681959bd350f8a2a4ba6100c66
|
data/.github/workflows/ruby.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
8.
|
1
|
+
8.5.0
|
@@ -37,7 +37,9 @@ class CheckboxSubmit {
|
|
37
37
|
this.labelTarget.removeAttribute('disabled');
|
38
38
|
this.checkboxTarget.removeAttribute('disabled');
|
39
39
|
this.updateStateFor(!this.checked);
|
40
|
-
|
40
|
+
this.bookmarksCounter().forEach(counter => {
|
41
|
+
counter.innerHTML = json.bookmarks.count;
|
42
|
+
});
|
41
43
|
}).catch((error) => {
|
42
44
|
this.handleError(error);
|
43
45
|
});
|
@@ -63,8 +65,8 @@ class CheckboxSubmit {
|
|
63
65
|
return this.form.querySelector('[data-checkboxsubmit-target="span"]')
|
64
66
|
}
|
65
67
|
|
66
|
-
|
67
|
-
return document.
|
68
|
+
bookmarksCounter() {
|
69
|
+
return document.querySelectorAll('[data-role="bookmark-counter"]')
|
68
70
|
}
|
69
71
|
|
70
72
|
handleError() {
|
@@ -334,7 +336,7 @@ SearchContext.handleSearchContextMethod = function(event) {
|
|
334
336
|
|
335
337
|
document.addEventListener('click', SearchContext);
|
336
338
|
|
337
|
-
const
|
339
|
+
const Core = function() {
|
338
340
|
const buffer = new Array;
|
339
341
|
return {
|
340
342
|
onLoad: function(func) {
|
@@ -370,13 +372,13 @@ const Blacklight = function() {
|
|
370
372
|
|
371
373
|
// turbolinks triggers page:load events on page transition
|
372
374
|
// If app isn't using turbolinks, this event will never be triggered, no prob.
|
373
|
-
|
375
|
+
Core.listeners().forEach(function(listener) {
|
374
376
|
document.addEventListener(listener, function() {
|
375
|
-
|
377
|
+
Core.activate();
|
376
378
|
});
|
377
379
|
});
|
378
380
|
|
379
|
-
|
381
|
+
Core.onLoad(function () {
|
380
382
|
const elem = document.querySelector('.no-js');
|
381
383
|
|
382
384
|
// The "no-js" class may already have been removed because this function is
|
@@ -392,8 +394,8 @@ const index = {
|
|
392
394
|
ButtonFocus,
|
393
395
|
Modal,
|
394
396
|
SearchContext,
|
395
|
-
Core
|
396
|
-
onLoad:
|
397
|
+
Core,
|
398
|
+
onLoad: Core.onLoad
|
397
399
|
};
|
398
400
|
|
399
401
|
export { index as default };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"blacklight.esm.js","sources":["../../../javascript/blacklight/checkbox_submit.js","../../../javascript/blacklight/bookmark_toggle.js","../../../javascript/blacklight/button_focus.js","../../../javascript/blacklight/modal.js","../../../javascript/blacklight/search_context.js","../../../javascript/blacklight/core.js","../../../javascript/blacklight/index.js"],"sourcesContent":["/* Converts a \"toggle\" form, with single submit button to add/remove\n something, like used for Bookmarks, into an AJAXy checkbox instead.\n Apply to a form. Does require certain assumption about the form:\n 1) The same form 'action' href must be used for both ADD and REMOVE\n actions, with the different being the hidden input name=\"_method\"\n being set to \"put\" or \"delete\" -- that's the Rails method to pretend\n to be doing a certain HTTP verb. So same URL, PUT to add, DELETE\n to remove. This plugin assumes that.\n Plus, the form this is applied to should provide a data-doc-id\n attribute (HTML5-style doc-*) that contains the id/primary key\n of the object in question -- used by plugin for a unique value for\n DOM id's.\n Uses HTML for a checkbox compatible with Bootstrap 4.\n new CheckboxSubmit(document.querySelector('form.something')).render()\n*/\nexport default class CheckboxSubmit {\n constructor(form) {\n this.form = form\n }\n\n clicked(evt) {\n this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress')\n this.labelTarget.setAttribute('disabled', 'disabled');\n this.checkboxTarget.setAttribute('disabled', 'disabled');\n fetch(this.formTarget.getAttribute('action'), {\n body: new FormData(this.formTarget),\n method: this.formTarget.getAttribute('method').toUpperCase(),\n headers: {\n 'Accept': 'application/json',\n 'X-Requested-With': 'XMLHttpRequest',\n 'X-CSRF-Token': document.querySelector('meta[name=csrf-token]')?.content\n }\n }).then((response) => {\n if (response.ok) return response.json();\n return Promise.reject('response was not ok')\n }).then((json) => {\n this.labelTarget.removeAttribute('disabled')\n this.checkboxTarget.removeAttribute('disabled')\n this.updateStateFor(!this.checked)\n if (this.bookmarkCounter()) this.bookmarkCounter().innerHTML = json.bookmarks.count\n }).catch((error) => {\n this.handleError(error)\n })\n }\n\n get checked() {\n return (this.form.querySelectorAll('input[name=_method][value=delete]').length != 0)\n }\n\n get formTarget() {\n return this.form\n }\n\n get labelTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"label\"]')\n }\n\n get checkboxTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"checkbox\"]')\n }\n\n get spanTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"span\"]')\n }\n\n bookmarkCounter() {\n return document.querySelector('[data-role=\"bookmark-counter\"]')\n }\n\n handleError() {\n alert(\"Unable to save the bookmark at this time.\")\n }\n\n updateStateFor(state) {\n this.checkboxTarget.checked = state\n\n if (state) {\n this.labelTarget.classList.add('checked')\n //Set the Rails hidden field that fakes an HTTP verb\n //properly for current state action.\n this.formTarget.querySelector('input[name=_method]').value = 'delete'\n this.spanTarget.innerHTML = this.form.getAttribute('data-present')\n } else {\n this.labelTarget.classList.remove('checked')\n this.formTarget.querySelector('input[name=_method]').value = 'put'\n this.spanTarget.innerHTML = this.form.getAttribute('data-absent')\n }\n }\n}\n","import CheckboxSubmit from 'blacklight/checkbox_submit'\n\nconst BookmarkToggle = (e) => {\n if (e.target.matches('[data-checkboxsubmit-target=\"checkbox\"]')) {\n const form = e.target.closest('form')\n if (form) new CheckboxSubmit(form).clicked(e);\n }\n};\n\ndocument.addEventListener('click', BookmarkToggle);\n\nexport default BookmarkToggle\n","const ButtonFocus = (e) => {\n // Button clicks should change focus. As of 10/3/19, Firefox for Mac and\n // Safari both do not set focus to a button on button click.\n // See https://zellwk.com/blog/inconsistent-button-behavior/ for background information\n if (e.target.matches('[data-toggle=\"collapse\"]') || e.target.matches('[data-bs-toggle=\"collapse\"]')) {\n e.target.focus()\n }\n}\n\ndocument.addEventListener('click', ButtonFocus)\n\nexport default ButtonFocus\n","/*\n The blacklight modal plugin can display some interactions inside a Bootstrap\n modal window, including some multi-page interactions.\n\n It supports unobtrusive Javascript, where a link or form that would have caused\n a new page load is changed to display it's results inside a modal dialog,\n by this plugin. The plugin assumes there is a Bootstrap modal div\n on the page with id #blacklight-modal to use as the modal -- the standard Blacklight\n layout provides this.\n\n To make a link or form have their results display inside a modal, add\n `data-blacklight-modal=\"trigger\"` to the link or form. (Note, form itself not submit input)\n With Rails link_to helper, you'd do that like:\n\n link_to something, link, data: { blacklight_modal: \"trigger\" }\n\n The results of the link href or form submit will be displayed inside\n a modal -- they should include the proper HTML markup for a bootstrap modal's\n contents. Also, you ordinarily won't want the Rails template with wrapping\n navigational elements to be used. The Rails controller could suppress\n the layout when a JS AJAX request is detected, OR the response\n can include a `<div data-blacklight-modal=\"container\">` -- only the contents\n of the container will be placed inside the modal, the rest of the\n page will be ignored.\n\n Link or forms inside the modal will ordinarily cause page loads\n when they are triggered. However, if you'd like their results\n to stay within the modal, just add `data-blacklight-modal=\"preserve\"`\n to the link or form.\n\n Here's an example of what might be returned, demonstrating most of the devices available:\n\n <div data-blacklight-modal=\"container\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-bl-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h3 class=\"modal-title\">Request Placed</h3>\n </div>\n\n <div class=\"modal-body\">\n <p>Some message</p>\n <%= link_to \"This result will still be within modal\", some_link, data: { blacklight_modal: \"preserve\" } %>\n </div>\n\n\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-bl-dismiss=\"modal\">Close</button>\n </div>\n </div>\n\n\n One additional feature. If the content returned from the AJAX form submission\n can be a turbo-stream that defines some HTML fragementsand where on the page to put them:\n https://turbo.hotwired.dev/handbook/streams\n*/\nimport ModalForm from 'blacklight/modalForm'\n\nconst Modal = (() => {\n const modal = {}\n\n // a Bootstrap modal div that should be already on the page hidden\n modal.modalSelector = '#blacklight-modal';\n\n // Trigger selectors identify forms or hyperlinks that should open\n // inside a modal dialog.\n modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';\n\n // preserve selectors identify forms or hyperlinks that, if activated already\n // inside a modal dialog, should have destinations remain inside the modal -- but\n // won't trigger a modal if not already in one.\n //\n // No need to repeat selectors from trigger selectors, those will already\n // be preserved. MUST be manually prefixed with the modal selector,\n // so they only apply to things inside a modal.\n modal.preserveLinkSelector = modal.modalSelector + ' a[data-blacklight-modal~=preserve]';\n\n modal.containerSelector = '[data-blacklight-modal~=container]';\n\n // Called on fatal failure of ajax load, function returns content\n // to show to user in modal. Right now called only for network errors.\n modal.onFailure = function (error) {\n console.error('Server error:', this.url, error);\n\n const contents = `<div class=\"modal-header\">\n <div class=\"modal-title\">There was a problem with your request.</div>\n <button type=\"button\" class=\"blacklight-modal-close btn-close close\" data-bl-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <p>Expected a successful response from the server, but got an error</p>\n <pre>${this.url}\\n${error}</pre>\n </div>`\n\n document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents\n\n modal.show();\n }\n\n // Add the passed in contents to the modal and display it.\n // We have specific handling so that scripts returned from the ajax call are executed.\n // This enables adding a script like recaptcha to prevent bots from sending emails.\n modal.receiveAjax = function (contents) {\n const domparser = new DOMParser();\n const dom = domparser.parseFromString(contents, \"text/html\")\n // If there is a containerSelector on the document, use its children.\n let elements = dom.querySelectorAll(`${modal.containerSelector} > *`)\n const frag = document.createDocumentFragment()\n if (elements.length == 0) {\n // If the containerSelector wasn't found, use the whole document\n elements = dom.body.childNodes\n }\n elements.forEach((el) => frag.appendChild(el))\n modal.activateScripts(frag)\n \n document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(frag)\n\n modal.show();\n };\n\n // DOMParser doesn't allow scripts to be executed. This fixes that.\n modal.activateScripts = function (frag) {\n frag.querySelectorAll('script').forEach((script) => {\n const fixedScript = document.createElement('script')\n fixedScript.src = script.src\n fixedScript.async = false\n script.parentNode.replaceChild(fixedScript, script)\n })\n }\n\n modal.modalAjaxLinkClick = function(e) {\n e.preventDefault();\n const href = e.target.getAttribute('href')\n fetch(href)\n .then(response => {\n if (!response.ok) {\n throw new TypeError(\"Request failed\");\n }\n return response.text();\n })\n .then(data => modal.receiveAjax(data))\n .catch(error => modal.onFailure(error))\n };\n\n modal.setupModal = function() {\n // Register both trigger and preserve selectors in ONE event handler, combining\n // into one selector with a comma, so if something matches BOTH selectors, it\n // still only gets the event handler called once.\n document.addEventListener('click', (e) => {\n if (e.target.closest(`${modal.triggerLinkSelector}, ${modal.preserveLinkSelector}`))\n modal.modalAjaxLinkClick(e)\n else if (e.target.closest('[data-bl-dismiss=\"modal\"]'))\n modal.hide()\n })\n };\n\n modal.hide = function (el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (!dom.open) return\n dom.close()\n }\n\n modal.show = function(el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (dom.open) return\n dom.showModal()\n }\n\n modal.setupModal()\n\n return modal;\n})()\n\nexport default Modal\n","const SearchContext = (e) => {\n if (e.target.matches('[data-context-href]')) {\n SearchContext.handleSearchContextMethod.call(e.target, e)\n }\n}\n\nSearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content\nSearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content\n\n// this is the Rails.handleMethod with a couple adjustments, described inline:\n// first, we're attaching this directly to the event handler, so we can check for meta-keys\nSearchContext.handleSearchContextMethod = function(event) {\n const link = this\n\n // instead of using the normal href, we need to use the context href instead\n let href = link.getAttribute('data-context-href')\n let target = link.getAttribute('target')\n let csrfToken = SearchContext.csrfToken()\n let csrfParam = SearchContext.csrfParam()\n let form = document.createElement('form')\n form.method = 'post'\n form.action = href\n\n\n let formContent = `<input name=\"_method\" value=\"post\" type=\"hidden\" />\n <input name=\"redirect\" value=\"${link.getAttribute('href')}\" type=\"hidden\" />`\n\n // check for meta keys.. if set, we should open in a new tab\n if(event.metaKey || event.ctrlKey) {\n form.dataset.turbo = \"false\";\n target = '_blank';\n }\n\n if (csrfParam !== undefined && csrfToken !== undefined) {\n formContent += `<input name=\"${csrfParam}\" value=\"${csrfToken}\" type=\"hidden\" />`\n }\n\n // Must trigger submit by click on a button, else \"submit\" event handler won't work!\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n formContent += '<input type=\"submit\" />'\n\n if (target) { form.setAttribute('target', target); }\n\n form.style.display = 'none'\n form.innerHTML = formContent\n document.body.appendChild(form)\n form.querySelector('[type=\"submit\"]').click()\n\n event.preventDefault()\n};\n\ndocument.addEventListener('click', SearchContext)\n\nexport default SearchContext\n","const Blacklight = function() {\n const buffer = new Array;\n return {\n onLoad: function(func) {\n buffer.push(func);\n },\n\n activate: function() {\n for(let i = 0; i < buffer.length; i++) {\n buffer[i].call();\n }\n },\n\n listeners: function () {\n const listeners = [];\n if (typeof Turbo !== 'undefined') {\n listeners.push('turbo:load', 'turbo:frame-load');\n } else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {\n // Turbolinks 5\n if (Turbolinks.BrowserAdapter) {\n listeners.push('turbolinks:load');\n } else {\n // Turbolinks < 5\n listeners.push('page:load', 'DOMContentLoaded');\n }\n } else {\n listeners.push('DOMContentLoaded');\n }\n\n return listeners;\n }\n };\n}();\n\n// turbolinks triggers page:load events on page transition\n// If app isn't using turbolinks, this event will never be triggered, no prob.\nBlacklight.listeners().forEach(function(listener) {\n document.addEventListener(listener, function() {\n Blacklight.activate()\n })\n})\n\nBlacklight.onLoad(function () {\n const elem = document.querySelector('.no-js');\n\n // The \"no-js\" class may already have been removed because this function is\n // run on every turbo:load event, in that case, it won't find an element.\n if (!elem) return;\n\n elem.classList.remove('no-js')\n elem.classList.add('js')\n})\n\n\nexport default Blacklight\n","import BookmarkToggle from 'blacklight/bookmark_toggle'\nimport ButtonFocus from 'blacklight/button_focus'\nimport Modal from 'blacklight/modal'\nimport SearchContext from 'blacklight/search_context'\nimport Core from 'blacklight/core'\n\nexport default {\n BookmarkToggle,\n ButtonFocus,\n Modal,\n SearchContext,\n Core,\n onLoad: Core.onLoad\n}\n"],"names":["Core"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAM,cAAc,CAAC;AACpC,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG,EAAE;AACf,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAC;AACzE,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC7D,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;AAClD,MAAM,IAAI,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;AACzC,MAAM,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE;AAClE,MAAM,OAAO,EAAE;AACf,QAAQ,QAAQ,EAAE,kBAAkB;AACpC,QAAQ,kBAAkB,EAAE,gBAAgB;AAC5C,QAAQ,cAAc,EAAE,QAAQ,CAAC,aAAa,C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OAAO;AACP;AACA,MAAM,OAAO,SAAS,CAAC;AACvB,KAAK;AACL,GAAG,CAAC;AACJ,CAAC,EAAE,CAAC;AACJ;AACA;AACA;AACA,UAAU,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,SAAS,QAAQ,EAAE;AAClD,EAAE,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW;AACjD,IAAI,UAAU,CAAC,QAAQ,GAAE;AACzB,GAAG,EAAC;AACJ,CAAC,EAAC;AACF;AACA,UAAU,CAAC,MAAM,CAAC,YAAY;AAC9B,EAAE,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChD;AACA;AACA;AACA,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO;AACpB;AACA,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAC;AAChC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAC;AAC1B,CAAC;;AC7CD,cAAe;AACf,EAAE,cAAc;AAChB,EAAE,WAAW;AACb,EAAE,KAAK;AACP,EAAE,aAAa;AACf,QAAEA,UAAI;AACN,EAAE,MAAM,EAAEA,UAAI,CAAC,MAAM;AACrB;;;;"}
|
1
|
+
{"version":3,"file":"blacklight.esm.js","sources":["../../../javascript/blacklight/checkbox_submit.js","../../../javascript/blacklight/bookmark_toggle.js","../../../javascript/blacklight/button_focus.js","../../../javascript/blacklight/modal.js","../../../javascript/blacklight/search_context.js","../../../javascript/blacklight/core.js","../../../javascript/blacklight/index.js"],"sourcesContent":["/* Converts a \"toggle\" form, with single submit button to add/remove\n something, like used for Bookmarks, into an AJAXy checkbox instead.\n Apply to a form. Does require certain assumption about the form:\n 1) The same form 'action' href must be used for both ADD and REMOVE\n actions, with the different being the hidden input name=\"_method\"\n being set to \"put\" or \"delete\" -- that's the Rails method to pretend\n to be doing a certain HTTP verb. So same URL, PUT to add, DELETE\n to remove. This plugin assumes that.\n Plus, the form this is applied to should provide a data-doc-id\n attribute (HTML5-style doc-*) that contains the id/primary key\n of the object in question -- used by plugin for a unique value for\n DOM id's.\n Uses HTML for a checkbox compatible with Bootstrap 4.\n new CheckboxSubmit(document.querySelector('form.something')).render()\n*/\nexport default class CheckboxSubmit {\n constructor(form) {\n this.form = form\n }\n\n clicked(evt) {\n this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress')\n this.labelTarget.setAttribute('disabled', 'disabled');\n this.checkboxTarget.setAttribute('disabled', 'disabled');\n fetch(this.formTarget.getAttribute('action'), {\n body: new FormData(this.formTarget),\n method: this.formTarget.getAttribute('method').toUpperCase(),\n headers: {\n 'Accept': 'application/json',\n 'X-Requested-With': 'XMLHttpRequest',\n 'X-CSRF-Token': document.querySelector('meta[name=csrf-token]')?.content\n }\n }).then((response) => {\n if (response.ok) return response.json();\n return Promise.reject('response was not ok')\n }).then((json) => {\n this.labelTarget.removeAttribute('disabled')\n this.checkboxTarget.removeAttribute('disabled')\n this.updateStateFor(!this.checked)\n this.bookmarksCounter().forEach(counter => {\n counter.innerHTML = json.bookmarks.count;\n });\n }).catch((error) => {\n this.handleError(error)\n })\n }\n\n get checked() {\n return (this.form.querySelectorAll('input[name=_method][value=delete]').length != 0)\n }\n\n get formTarget() {\n return this.form\n }\n\n get labelTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"label\"]')\n }\n\n get checkboxTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"checkbox\"]')\n }\n\n get spanTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"span\"]')\n }\n\n bookmarksCounter() {\n return document.querySelectorAll('[data-role=\"bookmark-counter\"]')\n }\n\n handleError() {\n alert(\"Unable to save the bookmark at this time.\")\n }\n\n updateStateFor(state) {\n this.checkboxTarget.checked = state\n\n if (state) {\n this.labelTarget.classList.add('checked')\n //Set the Rails hidden field that fakes an HTTP verb\n //properly for current state action.\n this.formTarget.querySelector('input[name=_method]').value = 'delete'\n this.spanTarget.innerHTML = this.form.getAttribute('data-present')\n } else {\n this.labelTarget.classList.remove('checked')\n this.formTarget.querySelector('input[name=_method]').value = 'put'\n this.spanTarget.innerHTML = this.form.getAttribute('data-absent')\n }\n }\n}\n","import CheckboxSubmit from 'blacklight/checkbox_submit'\n\nconst BookmarkToggle = (e) => {\n if (e.target.matches('[data-checkboxsubmit-target=\"checkbox\"]')) {\n const form = e.target.closest('form')\n if (form) new CheckboxSubmit(form).clicked(e);\n }\n};\n\ndocument.addEventListener('click', BookmarkToggle);\n\nexport default BookmarkToggle\n","const ButtonFocus = (e) => {\n // Button clicks should change focus. As of 10/3/19, Firefox for Mac and\n // Safari both do not set focus to a button on button click.\n // See https://zellwk.com/blog/inconsistent-button-behavior/ for background information\n if (e.target.matches('[data-toggle=\"collapse\"]') || e.target.matches('[data-bs-toggle=\"collapse\"]')) {\n e.target.focus()\n }\n}\n\ndocument.addEventListener('click', ButtonFocus)\n\nexport default ButtonFocus\n","/*\n The blacklight modal plugin can display some interactions inside a Bootstrap\n modal window, including some multi-page interactions.\n\n It supports unobtrusive Javascript, where a link or form that would have caused\n a new page load is changed to display it's results inside a modal dialog,\n by this plugin. The plugin assumes there is a Bootstrap modal div\n on the page with id #blacklight-modal to use as the modal -- the standard Blacklight\n layout provides this.\n\n To make a link or form have their results display inside a modal, add\n `data-blacklight-modal=\"trigger\"` to the link or form. (Note, form itself not submit input)\n With Rails link_to helper, you'd do that like:\n\n link_to something, link, data: { blacklight_modal: \"trigger\" }\n\n The results of the link href or form submit will be displayed inside\n a modal -- they should include the proper HTML markup for a bootstrap modal's\n contents. Also, you ordinarily won't want the Rails template with wrapping\n navigational elements to be used. The Rails controller could suppress\n the layout when a JS AJAX request is detected, OR the response\n can include a `<div data-blacklight-modal=\"container\">` -- only the contents\n of the container will be placed inside the modal, the rest of the\n page will be ignored.\n\n Link or forms inside the modal will ordinarily cause page loads\n when they are triggered. However, if you'd like their results\n to stay within the modal, just add `data-blacklight-modal=\"preserve\"`\n to the link or form.\n\n Here's an example of what might be returned, demonstrating most of the devices available:\n\n <div data-blacklight-modal=\"container\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-bl-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h3 class=\"modal-title\">Request Placed</h3>\n </div>\n\n <div class=\"modal-body\">\n <p>Some message</p>\n <%= link_to \"This result will still be within modal\", some_link, data: { blacklight_modal: \"preserve\" } %>\n </div>\n\n\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-bl-dismiss=\"modal\">Close</button>\n </div>\n </div>\n\n\n One additional feature. If the content returned from the AJAX form submission\n can be a turbo-stream that defines some HTML fragementsand where on the page to put them:\n https://turbo.hotwired.dev/handbook/streams\n*/\nimport ModalForm from 'blacklight/modalForm'\n\nconst Modal = (() => {\n const modal = {}\n\n // a Bootstrap modal div that should be already on the page hidden\n modal.modalSelector = '#blacklight-modal';\n\n // Trigger selectors identify forms or hyperlinks that should open\n // inside a modal dialog.\n modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';\n\n // preserve selectors identify forms or hyperlinks that, if activated already\n // inside a modal dialog, should have destinations remain inside the modal -- but\n // won't trigger a modal if not already in one.\n //\n // No need to repeat selectors from trigger selectors, those will already\n // be preserved. MUST be manually prefixed with the modal selector,\n // so they only apply to things inside a modal.\n modal.preserveLinkSelector = modal.modalSelector + ' a[data-blacklight-modal~=preserve]';\n\n modal.containerSelector = '[data-blacklight-modal~=container]';\n\n // Called on fatal failure of ajax load, function returns content\n // to show to user in modal. Right now called only for network errors.\n modal.onFailure = function (error) {\n console.error('Server error:', this.url, error);\n\n const contents = `<div class=\"modal-header\">\n <div class=\"modal-title\">There was a problem with your request.</div>\n <button type=\"button\" class=\"blacklight-modal-close btn-close close\" data-bl-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <p>Expected a successful response from the server, but got an error</p>\n <pre>${this.url}\\n${error}</pre>\n </div>`\n\n document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents\n\n modal.show();\n }\n\n // Add the passed in contents to the modal and display it.\n // We have specific handling so that scripts returned from the ajax call are executed.\n // This enables adding a script like recaptcha to prevent bots from sending emails.\n modal.receiveAjax = function (contents) {\n const domparser = new DOMParser();\n const dom = domparser.parseFromString(contents, \"text/html\")\n // If there is a containerSelector on the document, use its children.\n let elements = dom.querySelectorAll(`${modal.containerSelector} > *`)\n const frag = document.createDocumentFragment()\n if (elements.length == 0) {\n // If the containerSelector wasn't found, use the whole document\n elements = dom.body.childNodes\n }\n elements.forEach((el) => frag.appendChild(el))\n modal.activateScripts(frag)\n \n document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(frag)\n\n modal.show();\n };\n\n // DOMParser doesn't allow scripts to be executed. This fixes that.\n modal.activateScripts = function (frag) {\n frag.querySelectorAll('script').forEach((script) => {\n const fixedScript = document.createElement('script')\n fixedScript.src = script.src\n fixedScript.async = false\n script.parentNode.replaceChild(fixedScript, script)\n })\n }\n\n modal.modalAjaxLinkClick = function(e) {\n e.preventDefault();\n const href = e.target.getAttribute('href')\n fetch(href)\n .then(response => {\n if (!response.ok) {\n throw new TypeError(\"Request failed\");\n }\n return response.text();\n })\n .then(data => modal.receiveAjax(data))\n .catch(error => modal.onFailure(error))\n };\n\n modal.setupModal = function() {\n // Register both trigger and preserve selectors in ONE event handler, combining\n // into one selector with a comma, so if something matches BOTH selectors, it\n // still only gets the event handler called once.\n document.addEventListener('click', (e) => {\n if (e.target.closest(`${modal.triggerLinkSelector}, ${modal.preserveLinkSelector}`))\n modal.modalAjaxLinkClick(e)\n else if (e.target.closest('[data-bl-dismiss=\"modal\"]'))\n modal.hide()\n })\n };\n\n modal.hide = function (el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (!dom.open) return\n dom.close()\n }\n\n modal.show = function(el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (dom.open) return\n dom.showModal()\n }\n\n modal.setupModal()\n\n return modal;\n})()\n\nexport default Modal\n","const SearchContext = (e) => {\n if (e.target.matches('[data-context-href]')) {\n SearchContext.handleSearchContextMethod.call(e.target, e)\n }\n}\n\nSearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content\nSearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content\n\n// this is the Rails.handleMethod with a couple adjustments, described inline:\n// first, we're attaching this directly to the event handler, so we can check for meta-keys\nSearchContext.handleSearchContextMethod = function(event) {\n const link = this\n\n // instead of using the normal href, we need to use the context href instead\n let href = link.getAttribute('data-context-href')\n let target = link.getAttribute('target')\n let csrfToken = SearchContext.csrfToken()\n let csrfParam = SearchContext.csrfParam()\n let form = document.createElement('form')\n form.method = 'post'\n form.action = href\n\n\n let formContent = `<input name=\"_method\" value=\"post\" type=\"hidden\" />\n <input name=\"redirect\" value=\"${link.getAttribute('href')}\" type=\"hidden\" />`\n\n // check for meta keys.. if set, we should open in a new tab\n if(event.metaKey || event.ctrlKey) {\n form.dataset.turbo = \"false\";\n target = '_blank';\n }\n\n if (csrfParam !== undefined && csrfToken !== undefined) {\n formContent += `<input name=\"${csrfParam}\" value=\"${csrfToken}\" type=\"hidden\" />`\n }\n\n // Must trigger submit by click on a button, else \"submit\" event handler won't work!\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n formContent += '<input type=\"submit\" />'\n\n if (target) { form.setAttribute('target', target); }\n\n form.style.display = 'none'\n form.innerHTML = formContent\n document.body.appendChild(form)\n form.querySelector('[type=\"submit\"]').click()\n\n event.preventDefault()\n};\n\ndocument.addEventListener('click', SearchContext)\n\nexport default SearchContext\n","const Core = function() {\n const buffer = new Array;\n return {\n onLoad: function(func) {\n buffer.push(func);\n },\n\n activate: function() {\n for(let i = 0; i < buffer.length; i++) {\n buffer[i].call();\n }\n },\n\n listeners: function () {\n const listeners = [];\n if (typeof Turbo !== 'undefined') {\n listeners.push('turbo:load', 'turbo:frame-load');\n } else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {\n // Turbolinks 5\n if (Turbolinks.BrowserAdapter) {\n listeners.push('turbolinks:load');\n } else {\n // Turbolinks < 5\n listeners.push('page:load', 'DOMContentLoaded');\n }\n } else {\n listeners.push('DOMContentLoaded');\n }\n\n return listeners;\n }\n };\n}();\n\n// turbolinks triggers page:load events on page transition\n// If app isn't using turbolinks, this event will never be triggered, no prob.\nCore.listeners().forEach(function(listener) {\n document.addEventListener(listener, function() {\n Core.activate()\n })\n})\n\nCore.onLoad(function () {\n const elem = document.querySelector('.no-js');\n\n // The \"no-js\" class may already have been removed because this function is\n // run on every turbo:load event, in that case, it won't find an element.\n if (!elem) return;\n\n elem.classList.remove('no-js')\n elem.classList.add('js')\n})\n\n\nexport default Core\n","import BookmarkToggle from 'blacklight/bookmark_toggle'\nimport ButtonFocus from 'blacklight/button_focus'\nimport Modal from 'blacklight/modal'\nimport SearchContext from 'blacklight/search_context'\nimport Core from 'blacklight/core'\n\nexport default {\n BookmarkToggle,\n ButtonFocus,\n Modal,\n SearchContext,\n Core,\n onLoad: Core.onLoad\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAM,cAAc,CAAC;AACpC,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;AACpB,GAAG;AACH;AACA,EAAE,OAAO,CAAC,GAAG,EAAE;AACf,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAC;AACzE,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC7D,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY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('disabled');
|
45
45
|
this.updateStateFor(!this.checked);
|
46
|
-
|
46
|
+
this.bookmarksCounter().forEach(counter => {
|
47
|
+
counter.innerHTML = json.bookmarks.count;
|
48
|
+
});
|
47
49
|
}).catch((error) => {
|
48
50
|
this.handleError(error);
|
49
51
|
});
|
@@ -69,8 +71,8 @@
|
|
69
71
|
return this.form.querySelector('[data-checkboxsubmit-target="span"]')
|
70
72
|
}
|
71
73
|
|
72
|
-
|
73
|
-
return document.
|
74
|
+
bookmarksCounter() {
|
75
|
+
return document.querySelectorAll('[data-role="bookmark-counter"]')
|
74
76
|
}
|
75
77
|
|
76
78
|
handleError() {
|
@@ -340,7 +342,7 @@
|
|
340
342
|
|
341
343
|
document.addEventListener('click', SearchContext);
|
342
344
|
|
343
|
-
const
|
345
|
+
const Core = function() {
|
344
346
|
const buffer = new Array;
|
345
347
|
return {
|
346
348
|
onLoad: function(func) {
|
@@ -376,13 +378,13 @@
|
|
376
378
|
|
377
379
|
// turbolinks triggers page:load events on page transition
|
378
380
|
// If app isn't using turbolinks, this event will never be triggered, no prob.
|
379
|
-
|
381
|
+
Core.listeners().forEach(function(listener) {
|
380
382
|
document.addEventListener(listener, function() {
|
381
|
-
|
383
|
+
Core.activate();
|
382
384
|
});
|
383
385
|
});
|
384
386
|
|
385
|
-
|
387
|
+
Core.onLoad(function () {
|
386
388
|
const elem = document.querySelector('.no-js');
|
387
389
|
|
388
390
|
// The "no-js" class may already have been removed because this function is
|
@@ -398,8 +400,8 @@
|
|
398
400
|
ButtonFocus,
|
399
401
|
Modal,
|
400
402
|
SearchContext,
|
401
|
-
Core
|
402
|
-
onLoad:
|
403
|
+
Core,
|
404
|
+
onLoad: Core.onLoad
|
403
405
|
};
|
404
406
|
|
405
407
|
return index;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"blacklight.js","sources":["../../../javascript/blacklight/checkbox_submit.js","../../../javascript/blacklight/bookmark_toggle.js","../../../javascript/blacklight/button_focus.js","../../../javascript/blacklight/modal.js","../../../javascript/blacklight/search_context.js","../../../javascript/blacklight/core.js","../../../javascript/blacklight/index.js"],"sourcesContent":["/* Converts a \"toggle\" form, with single submit button to add/remove\n something, like used for Bookmarks, into an AJAXy checkbox instead.\n Apply to a form. Does require certain assumption about the form:\n 1) The same form 'action' href must be used for both ADD and REMOVE\n actions, with the different being the hidden input name=\"_method\"\n being set to \"put\" or \"delete\" -- that's the Rails method to pretend\n to be doing a certain HTTP verb. So same URL, PUT to add, DELETE\n to remove. This plugin assumes that.\n Plus, the form this is applied to should provide a data-doc-id\n attribute (HTML5-style doc-*) that contains the id/primary key\n of the object in question -- used by plugin for a unique value for\n DOM id's.\n Uses HTML for a checkbox compatible with Bootstrap 4.\n new CheckboxSubmit(document.querySelector('form.something')).render()\n*/\nexport default class CheckboxSubmit {\n constructor(form) {\n this.form = form\n }\n\n clicked(evt) {\n this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress')\n this.labelTarget.setAttribute('disabled', 'disabled');\n this.checkboxTarget.setAttribute('disabled', 'disabled');\n fetch(this.formTarget.getAttribute('action'), {\n body: new FormData(this.formTarget),\n method: this.formTarget.getAttribute('method').toUpperCase(),\n headers: {\n 'Accept': 'application/json',\n 'X-Requested-With': 'XMLHttpRequest',\n 'X-CSRF-Token': document.querySelector('meta[name=csrf-token]')?.content\n }\n }).then((response) => {\n if (response.ok) return response.json();\n return Promise.reject('response was not ok')\n }).then((json) => {\n this.labelTarget.removeAttribute('disabled')\n this.checkboxTarget.removeAttribute('disabled')\n this.updateStateFor(!this.checked)\n if (this.bookmarkCounter()) this.bookmarkCounter().innerHTML = json.bookmarks.count\n }).catch((error) => {\n this.handleError(error)\n })\n }\n\n get checked() {\n return (this.form.querySelectorAll('input[name=_method][value=delete]').length != 0)\n }\n\n get formTarget() {\n return this.form\n }\n\n get labelTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"label\"]')\n }\n\n get checkboxTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"checkbox\"]')\n }\n\n get spanTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"span\"]')\n }\n\n bookmarkCounter() {\n return document.querySelector('[data-role=\"bookmark-counter\"]')\n }\n\n handleError() {\n alert(\"Unable to save the bookmark at this time.\")\n }\n\n updateStateFor(state) {\n this.checkboxTarget.checked = state\n\n if (state) {\n this.labelTarget.classList.add('checked')\n //Set the Rails hidden field that fakes an HTTP verb\n //properly for current state action.\n this.formTarget.querySelector('input[name=_method]').value = 'delete'\n this.spanTarget.innerHTML = this.form.getAttribute('data-present')\n } else {\n this.labelTarget.classList.remove('checked')\n this.formTarget.querySelector('input[name=_method]').value = 'put'\n this.spanTarget.innerHTML = this.form.getAttribute('data-absent')\n }\n }\n}\n","import CheckboxSubmit from 'blacklight/checkbox_submit'\n\nconst BookmarkToggle = (e) => {\n if (e.target.matches('[data-checkboxsubmit-target=\"checkbox\"]')) {\n const form = e.target.closest('form')\n if (form) new CheckboxSubmit(form).clicked(e);\n }\n};\n\ndocument.addEventListener('click', BookmarkToggle);\n\nexport default BookmarkToggle\n","const ButtonFocus = (e) => {\n // Button clicks should change focus. As of 10/3/19, Firefox for Mac and\n // Safari both do not set focus to a button on button click.\n // See https://zellwk.com/blog/inconsistent-button-behavior/ for background information\n if (e.target.matches('[data-toggle=\"collapse\"]') || e.target.matches('[data-bs-toggle=\"collapse\"]')) {\n e.target.focus()\n }\n}\n\ndocument.addEventListener('click', ButtonFocus)\n\nexport default ButtonFocus\n","/*\n The blacklight modal plugin can display some interactions inside a Bootstrap\n modal window, including some multi-page interactions.\n\n It supports unobtrusive Javascript, where a link or form that would have caused\n a new page load is changed to display it's results inside a modal dialog,\n by this plugin. The plugin assumes there is a Bootstrap modal div\n on the page with id #blacklight-modal to use as the modal -- the standard Blacklight\n layout provides this.\n\n To make a link or form have their results display inside a modal, add\n `data-blacklight-modal=\"trigger\"` to the link or form. (Note, form itself not submit input)\n With Rails link_to helper, you'd do that like:\n\n link_to something, link, data: { blacklight_modal: \"trigger\" }\n\n The results of the link href or form submit will be displayed inside\n a modal -- they should include the proper HTML markup for a bootstrap modal's\n contents. Also, you ordinarily won't want the Rails template with wrapping\n navigational elements to be used. The Rails controller could suppress\n the layout when a JS AJAX request is detected, OR the response\n can include a `<div data-blacklight-modal=\"container\">` -- only the contents\n of the container will be placed inside the modal, the rest of the\n page will be ignored.\n\n Link or forms inside the modal will ordinarily cause page loads\n when they are triggered. However, if you'd like their results\n to stay within the modal, just add `data-blacklight-modal=\"preserve\"`\n to the link or form.\n\n Here's an example of what might be returned, demonstrating most of the devices available:\n\n <div data-blacklight-modal=\"container\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-bl-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h3 class=\"modal-title\">Request Placed</h3>\n </div>\n\n <div class=\"modal-body\">\n <p>Some message</p>\n <%= link_to \"This result will still be within modal\", some_link, data: { blacklight_modal: \"preserve\" } %>\n </div>\n\n\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-bl-dismiss=\"modal\">Close</button>\n </div>\n </div>\n\n\n One additional feature. If the content returned from the AJAX form submission\n can be a turbo-stream that defines some HTML fragementsand where on the page to put them:\n https://turbo.hotwired.dev/handbook/streams\n*/\nimport ModalForm from 'blacklight/modalForm'\n\nconst Modal = (() => {\n const modal = {}\n\n // a Bootstrap modal div that should be already on the page hidden\n modal.modalSelector = '#blacklight-modal';\n\n // Trigger selectors identify forms or hyperlinks that should open\n // inside a modal dialog.\n modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';\n\n // preserve selectors identify forms or hyperlinks that, if activated already\n // inside a modal dialog, should have destinations remain inside the modal -- but\n // won't trigger a modal if not already in one.\n //\n // No need to repeat selectors from trigger selectors, those will already\n // be preserved. MUST be manually prefixed with the modal selector,\n // so they only apply to things inside a modal.\n modal.preserveLinkSelector = modal.modalSelector + ' a[data-blacklight-modal~=preserve]';\n\n modal.containerSelector = '[data-blacklight-modal~=container]';\n\n // Called on fatal failure of ajax load, function returns content\n // to show to user in modal. Right now called only for network errors.\n modal.onFailure = function (error) {\n console.error('Server error:', this.url, error);\n\n const contents = `<div class=\"modal-header\">\n <div class=\"modal-title\">There was a problem with your request.</div>\n <button type=\"button\" class=\"blacklight-modal-close btn-close close\" data-bl-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <p>Expected a successful response from the server, but got an error</p>\n <pre>${this.url}\\n${error}</pre>\n </div>`\n\n document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents\n\n modal.show();\n }\n\n // Add the passed in contents to the modal and display it.\n // We have specific handling so that scripts returned from the ajax call are executed.\n // This enables adding a script like recaptcha to prevent bots from sending emails.\n modal.receiveAjax = function (contents) {\n const domparser = new DOMParser();\n const dom = domparser.parseFromString(contents, \"text/html\")\n // If there is a containerSelector on the document, use its children.\n let elements = dom.querySelectorAll(`${modal.containerSelector} > *`)\n const frag = document.createDocumentFragment()\n if (elements.length == 0) {\n // If the containerSelector wasn't found, use the whole document\n elements = dom.body.childNodes\n }\n elements.forEach((el) => frag.appendChild(el))\n modal.activateScripts(frag)\n \n document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(frag)\n\n modal.show();\n };\n\n // DOMParser doesn't allow scripts to be executed. This fixes that.\n modal.activateScripts = function (frag) {\n frag.querySelectorAll('script').forEach((script) => {\n const fixedScript = document.createElement('script')\n fixedScript.src = script.src\n fixedScript.async = false\n script.parentNode.replaceChild(fixedScript, script)\n })\n }\n\n modal.modalAjaxLinkClick = function(e) {\n e.preventDefault();\n const href = e.target.getAttribute('href')\n fetch(href)\n .then(response => {\n if (!response.ok) {\n throw new TypeError(\"Request failed\");\n }\n return response.text();\n })\n .then(data => modal.receiveAjax(data))\n .catch(error => modal.onFailure(error))\n };\n\n modal.setupModal = function() {\n // Register both trigger and preserve selectors in ONE event handler, combining\n // into one selector with a comma, so if something matches BOTH selectors, it\n // still only gets the event handler called once.\n document.addEventListener('click', (e) => {\n if (e.target.closest(`${modal.triggerLinkSelector}, ${modal.preserveLinkSelector}`))\n modal.modalAjaxLinkClick(e)\n else if (e.target.closest('[data-bl-dismiss=\"modal\"]'))\n modal.hide()\n })\n };\n\n modal.hide = function (el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (!dom.open) return\n dom.close()\n }\n\n modal.show = function(el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (dom.open) return\n dom.showModal()\n }\n\n modal.setupModal()\n\n return modal;\n})()\n\nexport default Modal\n","const SearchContext = (e) => {\n if (e.target.matches('[data-context-href]')) {\n SearchContext.handleSearchContextMethod.call(e.target, e)\n }\n}\n\nSearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content\nSearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content\n\n// this is the Rails.handleMethod with a couple adjustments, described inline:\n// first, we're attaching this directly to the event handler, so we can check for meta-keys\nSearchContext.handleSearchContextMethod = function(event) {\n const link = this\n\n // instead of using the normal href, we need to use the context href instead\n let href = link.getAttribute('data-context-href')\n let target = link.getAttribute('target')\n let csrfToken = SearchContext.csrfToken()\n let csrfParam = SearchContext.csrfParam()\n let form = document.createElement('form')\n form.method = 'post'\n form.action = href\n\n\n let formContent = `<input name=\"_method\" value=\"post\" type=\"hidden\" />\n <input name=\"redirect\" value=\"${link.getAttribute('href')}\" type=\"hidden\" />`\n\n // check for meta keys.. if set, we should open in a new tab\n if(event.metaKey || event.ctrlKey) {\n form.dataset.turbo = \"false\";\n target = '_blank';\n }\n\n if (csrfParam !== undefined && csrfToken !== undefined) {\n formContent += `<input name=\"${csrfParam}\" value=\"${csrfToken}\" type=\"hidden\" />`\n }\n\n // Must trigger submit by click on a button, else \"submit\" event handler won't work!\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n formContent += '<input type=\"submit\" />'\n\n if (target) { form.setAttribute('target', target); }\n\n form.style.display = 'none'\n form.innerHTML = formContent\n document.body.appendChild(form)\n form.querySelector('[type=\"submit\"]').click()\n\n event.preventDefault()\n};\n\ndocument.addEventListener('click', SearchContext)\n\nexport default SearchContext\n","const Blacklight = function() {\n const buffer = new Array;\n return {\n onLoad: function(func) {\n buffer.push(func);\n },\n\n activate: function() {\n for(let i = 0; i < buffer.length; i++) {\n buffer[i].call();\n }\n },\n\n listeners: function () {\n const listeners = [];\n if (typeof Turbo !== 'undefined') {\n listeners.push('turbo:load', 'turbo:frame-load');\n } else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {\n // Turbolinks 5\n if (Turbolinks.BrowserAdapter) {\n listeners.push('turbolinks:load');\n } else {\n // Turbolinks < 5\n listeners.push('page:load', 'DOMContentLoaded');\n }\n } else {\n listeners.push('DOMContentLoaded');\n }\n\n return listeners;\n }\n };\n}();\n\n// turbolinks triggers page:load events on page transition\n// If app isn't using turbolinks, this event will never be triggered, no prob.\nBlacklight.listeners().forEach(function(listener) {\n document.addEventListener(listener, function() {\n Blacklight.activate()\n })\n})\n\nBlacklight.onLoad(function () {\n const elem = document.querySelector('.no-js');\n\n // The \"no-js\" class may already have been removed because this function is\n // run on every turbo:load event, in that case, it won't find an element.\n if (!elem) return;\n\n elem.classList.remove('no-js')\n elem.classList.add('js')\n})\n\n\nexport default Blacklight\n","import BookmarkToggle from 'blacklight/bookmark_toggle'\nimport ButtonFocus from 'blacklight/button_focus'\nimport Modal from 'blacklight/modal'\nimport SearchContext from 'blacklight/search_context'\nimport Core from 'blacklight/core'\n\nexport default {\n BookmarkToggle,\n ButtonFocus,\n Modal,\n SearchContext,\n Core,\n onLoad: Core.onLoad\n}\n"],"names":["Core"],"mappings":";;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACe,MAAM,cAAc,CAAC;EACpC,EAAE,WAAW,CAAC,IAAI,EAAE;EACpB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;EACpB,GAAG;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AAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAC;EAC1B,CAAC;;AC7CD,gBAAe;EACf,EAAE,cAAc;EAChB,EAAE,WAAW;EACb,EAAE,KAAK;EACP,EAAE,aAAa;EACf,QAAEA,UAAI;EACN,EAAE,MAAM,EAAEA,UAAI,CAAC,MAAM;EACrB;;;;;;;;"}
|
1
|
+
{"version":3,"file":"blacklight.js","sources":["../../../javascript/blacklight/checkbox_submit.js","../../../javascript/blacklight/bookmark_toggle.js","../../../javascript/blacklight/button_focus.js","../../../javascript/blacklight/modal.js","../../../javascript/blacklight/search_context.js","../../../javascript/blacklight/core.js","../../../javascript/blacklight/index.js"],"sourcesContent":["/* Converts a \"toggle\" form, with single submit button to add/remove\n something, like used for Bookmarks, into an AJAXy checkbox instead.\n Apply to a form. Does require certain assumption about the form:\n 1) The same form 'action' href must be used for both ADD and REMOVE\n actions, with the different being the hidden input name=\"_method\"\n being set to \"put\" or \"delete\" -- that's the Rails method to pretend\n to be doing a certain HTTP verb. So same URL, PUT to add, DELETE\n to remove. This plugin assumes that.\n Plus, the form this is applied to should provide a data-doc-id\n attribute (HTML5-style doc-*) that contains the id/primary key\n of the object in question -- used by plugin for a unique value for\n DOM id's.\n Uses HTML for a checkbox compatible with Bootstrap 4.\n new CheckboxSubmit(document.querySelector('form.something')).render()\n*/\nexport default class CheckboxSubmit {\n constructor(form) {\n this.form = form\n }\n\n clicked(evt) {\n this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress')\n this.labelTarget.setAttribute('disabled', 'disabled');\n this.checkboxTarget.setAttribute('disabled', 'disabled');\n fetch(this.formTarget.getAttribute('action'), {\n body: new FormData(this.formTarget),\n method: this.formTarget.getAttribute('method').toUpperCase(),\n headers: {\n 'Accept': 'application/json',\n 'X-Requested-With': 'XMLHttpRequest',\n 'X-CSRF-Token': document.querySelector('meta[name=csrf-token]')?.content\n }\n }).then((response) => {\n if (response.ok) return response.json();\n return Promise.reject('response was not ok')\n }).then((json) => {\n this.labelTarget.removeAttribute('disabled')\n this.checkboxTarget.removeAttribute('disabled')\n this.updateStateFor(!this.checked)\n this.bookmarksCounter().forEach(counter => {\n counter.innerHTML = json.bookmarks.count;\n });\n }).catch((error) => {\n this.handleError(error)\n })\n }\n\n get checked() {\n return (this.form.querySelectorAll('input[name=_method][value=delete]').length != 0)\n }\n\n get formTarget() {\n return this.form\n }\n\n get labelTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"label\"]')\n }\n\n get checkboxTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"checkbox\"]')\n }\n\n get spanTarget() {\n return this.form.querySelector('[data-checkboxsubmit-target=\"span\"]')\n }\n\n bookmarksCounter() {\n return document.querySelectorAll('[data-role=\"bookmark-counter\"]')\n }\n\n handleError() {\n alert(\"Unable to save the bookmark at this time.\")\n }\n\n updateStateFor(state) {\n this.checkboxTarget.checked = state\n\n if (state) {\n this.labelTarget.classList.add('checked')\n //Set the Rails hidden field that fakes an HTTP verb\n //properly for current state action.\n this.formTarget.querySelector('input[name=_method]').value = 'delete'\n this.spanTarget.innerHTML = this.form.getAttribute('data-present')\n } else {\n this.labelTarget.classList.remove('checked')\n this.formTarget.querySelector('input[name=_method]').value = 'put'\n this.spanTarget.innerHTML = this.form.getAttribute('data-absent')\n }\n }\n}\n","import CheckboxSubmit from 'blacklight/checkbox_submit'\n\nconst BookmarkToggle = (e) => {\n if (e.target.matches('[data-checkboxsubmit-target=\"checkbox\"]')) {\n const form = e.target.closest('form')\n if (form) new CheckboxSubmit(form).clicked(e);\n }\n};\n\ndocument.addEventListener('click', BookmarkToggle);\n\nexport default BookmarkToggle\n","const ButtonFocus = (e) => {\n // Button clicks should change focus. As of 10/3/19, Firefox for Mac and\n // Safari both do not set focus to a button on button click.\n // See https://zellwk.com/blog/inconsistent-button-behavior/ for background information\n if (e.target.matches('[data-toggle=\"collapse\"]') || e.target.matches('[data-bs-toggle=\"collapse\"]')) {\n e.target.focus()\n }\n}\n\ndocument.addEventListener('click', ButtonFocus)\n\nexport default ButtonFocus\n","/*\n The blacklight modal plugin can display some interactions inside a Bootstrap\n modal window, including some multi-page interactions.\n\n It supports unobtrusive Javascript, where a link or form that would have caused\n a new page load is changed to display it's results inside a modal dialog,\n by this plugin. The plugin assumes there is a Bootstrap modal div\n on the page with id #blacklight-modal to use as the modal -- the standard Blacklight\n layout provides this.\n\n To make a link or form have their results display inside a modal, add\n `data-blacklight-modal=\"trigger\"` to the link or form. (Note, form itself not submit input)\n With Rails link_to helper, you'd do that like:\n\n link_to something, link, data: { blacklight_modal: \"trigger\" }\n\n The results of the link href or form submit will be displayed inside\n a modal -- they should include the proper HTML markup for a bootstrap modal's\n contents. Also, you ordinarily won't want the Rails template with wrapping\n navigational elements to be used. The Rails controller could suppress\n the layout when a JS AJAX request is detected, OR the response\n can include a `<div data-blacklight-modal=\"container\">` -- only the contents\n of the container will be placed inside the modal, the rest of the\n page will be ignored.\n\n Link or forms inside the modal will ordinarily cause page loads\n when they are triggered. However, if you'd like their results\n to stay within the modal, just add `data-blacklight-modal=\"preserve\"`\n to the link or form.\n\n Here's an example of what might be returned, demonstrating most of the devices available:\n\n <div data-blacklight-modal=\"container\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" data-bl-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h3 class=\"modal-title\">Request Placed</h3>\n </div>\n\n <div class=\"modal-body\">\n <p>Some message</p>\n <%= link_to \"This result will still be within modal\", some_link, data: { blacklight_modal: \"preserve\" } %>\n </div>\n\n\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-bl-dismiss=\"modal\">Close</button>\n </div>\n </div>\n\n\n One additional feature. If the content returned from the AJAX form submission\n can be a turbo-stream that defines some HTML fragementsand where on the page to put them:\n https://turbo.hotwired.dev/handbook/streams\n*/\nimport ModalForm from 'blacklight/modalForm'\n\nconst Modal = (() => {\n const modal = {}\n\n // a Bootstrap modal div that should be already on the page hidden\n modal.modalSelector = '#blacklight-modal';\n\n // Trigger selectors identify forms or hyperlinks that should open\n // inside a modal dialog.\n modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';\n\n // preserve selectors identify forms or hyperlinks that, if activated already\n // inside a modal dialog, should have destinations remain inside the modal -- but\n // won't trigger a modal if not already in one.\n //\n // No need to repeat selectors from trigger selectors, those will already\n // be preserved. MUST be manually prefixed with the modal selector,\n // so they only apply to things inside a modal.\n modal.preserveLinkSelector = modal.modalSelector + ' a[data-blacklight-modal~=preserve]';\n\n modal.containerSelector = '[data-blacklight-modal~=container]';\n\n // Called on fatal failure of ajax load, function returns content\n // to show to user in modal. Right now called only for network errors.\n modal.onFailure = function (error) {\n console.error('Server error:', this.url, error);\n\n const contents = `<div class=\"modal-header\">\n <div class=\"modal-title\">There was a problem with your request.</div>\n <button type=\"button\" class=\"blacklight-modal-close btn-close close\" data-bl-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <p>Expected a successful response from the server, but got an error</p>\n <pre>${this.url}\\n${error}</pre>\n </div>`\n\n document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents\n\n modal.show();\n }\n\n // Add the passed in contents to the modal and display it.\n // We have specific handling so that scripts returned from the ajax call are executed.\n // This enables adding a script like recaptcha to prevent bots from sending emails.\n modal.receiveAjax = function (contents) {\n const domparser = new DOMParser();\n const dom = domparser.parseFromString(contents, \"text/html\")\n // If there is a containerSelector on the document, use its children.\n let elements = dom.querySelectorAll(`${modal.containerSelector} > *`)\n const frag = document.createDocumentFragment()\n if (elements.length == 0) {\n // If the containerSelector wasn't found, use the whole document\n elements = dom.body.childNodes\n }\n elements.forEach((el) => frag.appendChild(el))\n modal.activateScripts(frag)\n \n document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(frag)\n\n modal.show();\n };\n\n // DOMParser doesn't allow scripts to be executed. This fixes that.\n modal.activateScripts = function (frag) {\n frag.querySelectorAll('script').forEach((script) => {\n const fixedScript = document.createElement('script')\n fixedScript.src = script.src\n fixedScript.async = false\n script.parentNode.replaceChild(fixedScript, script)\n })\n }\n\n modal.modalAjaxLinkClick = function(e) {\n e.preventDefault();\n const href = e.target.getAttribute('href')\n fetch(href)\n .then(response => {\n if (!response.ok) {\n throw new TypeError(\"Request failed\");\n }\n return response.text();\n })\n .then(data => modal.receiveAjax(data))\n .catch(error => modal.onFailure(error))\n };\n\n modal.setupModal = function() {\n // Register both trigger and preserve selectors in ONE event handler, combining\n // into one selector with a comma, so if something matches BOTH selectors, it\n // still only gets the event handler called once.\n document.addEventListener('click', (e) => {\n if (e.target.closest(`${modal.triggerLinkSelector}, ${modal.preserveLinkSelector}`))\n modal.modalAjaxLinkClick(e)\n else if (e.target.closest('[data-bl-dismiss=\"modal\"]'))\n modal.hide()\n })\n };\n\n modal.hide = function (el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (!dom.open) return\n dom.close()\n }\n\n modal.show = function(el) {\n const dom = document.querySelector(modal.modalSelector)\n\n if (dom.open) return\n dom.showModal()\n }\n\n modal.setupModal()\n\n return modal;\n})()\n\nexport default Modal\n","const SearchContext = (e) => {\n if (e.target.matches('[data-context-href]')) {\n SearchContext.handleSearchContextMethod.call(e.target, e)\n }\n}\n\nSearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content\nSearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content\n\n// this is the Rails.handleMethod with a couple adjustments, described inline:\n// first, we're attaching this directly to the event handler, so we can check for meta-keys\nSearchContext.handleSearchContextMethod = function(event) {\n const link = this\n\n // instead of using the normal href, we need to use the context href instead\n let href = link.getAttribute('data-context-href')\n let target = link.getAttribute('target')\n let csrfToken = SearchContext.csrfToken()\n let csrfParam = SearchContext.csrfParam()\n let form = document.createElement('form')\n form.method = 'post'\n form.action = href\n\n\n let formContent = `<input name=\"_method\" value=\"post\" type=\"hidden\" />\n <input name=\"redirect\" value=\"${link.getAttribute('href')}\" type=\"hidden\" />`\n\n // check for meta keys.. if set, we should open in a new tab\n if(event.metaKey || event.ctrlKey) {\n form.dataset.turbo = \"false\";\n target = '_blank';\n }\n\n if (csrfParam !== undefined && csrfToken !== undefined) {\n formContent += `<input name=\"${csrfParam}\" value=\"${csrfToken}\" type=\"hidden\" />`\n }\n\n // Must trigger submit by click on a button, else \"submit\" event handler won't work!\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n formContent += '<input type=\"submit\" />'\n\n if (target) { form.setAttribute('target', target); }\n\n form.style.display = 'none'\n form.innerHTML = formContent\n document.body.appendChild(form)\n form.querySelector('[type=\"submit\"]').click()\n\n event.preventDefault()\n};\n\ndocument.addEventListener('click', SearchContext)\n\nexport default SearchContext\n","const Core = function() {\n const buffer = new Array;\n return {\n onLoad: function(func) {\n buffer.push(func);\n },\n\n activate: function() {\n for(let i = 0; i < buffer.length; i++) {\n buffer[i].call();\n }\n },\n\n listeners: function () {\n const listeners = [];\n if (typeof Turbo !== 'undefined') {\n listeners.push('turbo:load', 'turbo:frame-load');\n } else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {\n // Turbolinks 5\n if (Turbolinks.BrowserAdapter) {\n listeners.push('turbolinks:load');\n } else {\n // Turbolinks < 5\n listeners.push('page:load', 'DOMContentLoaded');\n }\n } else {\n listeners.push('DOMContentLoaded');\n }\n\n return listeners;\n }\n };\n}();\n\n// turbolinks triggers page:load events on page transition\n// If app isn't using turbolinks, this event will never be triggered, no prob.\nCore.listeners().forEach(function(listener) {\n document.addEventListener(listener, function() {\n Core.activate()\n })\n})\n\nCore.onLoad(function () {\n const elem = document.querySelector('.no-js');\n\n // The \"no-js\" class may already have been removed because this function is\n // run on every turbo:load event, in that case, it won't find an element.\n if (!elem) return;\n\n elem.classList.remove('no-js')\n elem.classList.add('js')\n})\n\n\nexport default Core\n","import BookmarkToggle from 'blacklight/bookmark_toggle'\nimport ButtonFocus from 'blacklight/button_focus'\nimport Modal from 'blacklight/modal'\nimport SearchContext from 'blacklight/search_context'\nimport Core from 'blacklight/core'\n\nexport default {\n BookmarkToggle,\n ButtonFocus,\n Modal,\n SearchContext,\n Core,\n onLoad: Core.onLoad\n}\n"],"names":[],"mappings":";;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACe,MAAM,cAAc,CAAC;EACpC,EAAE,WAAW,CAAC,IAAI,EAAE;EACpB,IAAI,IAAI,CAAC,IAAI,GAAG,KAAI;EACpB,GAAG;AACH;EACA,EAAE,OAAO,CAAC,GAAG,EAAE;EACf,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAC;EACzE,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;EAC1D,IAAI,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;EAC7D,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;EAClD,MAAM,IAAI,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;EACzC,MAAM,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE;EAClE,MAAM,OAAO,EAAE;EACf,QAAQ,QAAQ,EAAE,kBAAkB;EACpC,QAAQ,kBAAkB,EAAE,gBAAgB;EAC5C,QAAQ,cAAc,EAAE,QAAQ,CAAC,aAAa,CAAC,uBAAuB,CAAC,EAAE,OAAO;EAChF,OAAO;EACP,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK;EAC1B,MAAM,IAAI,QAAQ,CAAC,EAAE,EAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;EAC9C,MAAM,OAAO,OAAO,CAAC,MAAM,CAAC,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EAC5C,EAAE,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW;EACjD,IAAI,IAAI,CAAC,QAAQ,GAAE;EACnB,GAAG,EAAC;EACJ,CAAC,EAAC;AACF;EACA,IAAI,CAAC,MAAM,CAAC,YAAY;EACxB,EAAE,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChD;EACA;EACA;EACA,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO;AACpB;EACA,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAC;EAChC,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAC;EAC1B,CAAC;;AC7CD,gBAAe;EACf,EAAE,cAAc;EAChB,EAAE,WAAW;EACb,EAAE,KAAK;EACP,EAAE,aAAa;EACf,EAAE,IAAI;EACN,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM;EACrB;;;;;;;;"}
|
@@ -1,7 +1,11 @@
|
|
1
1
|
<div class="search-context page-links">
|
2
|
-
|
2
|
+
<% if total == 1 %>
|
3
|
+
<%= item_page_entry_info %>
|
4
|
+
<% else %>
|
5
|
+
<%= link_to_previous_document %> |
|
3
6
|
|
4
|
-
|
7
|
+
<%= item_page_entry_info %> |
|
5
8
|
|
6
|
-
|
9
|
+
<%= link_to_next_document %>
|
10
|
+
<% end %>
|
7
11
|
</div>
|
@@ -12,7 +12,7 @@ module Blacklight
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def render?
|
15
|
-
@search_context.present? && (@search_context[:prev] || @search_context[:next]) && (@search_session['document_id'] == @current_document_id)
|
15
|
+
@search_context.present? && (@search_context[:prev] || @search_context[:next] || total.positive?) && (@search_session['document_id'] == @current_document_id)
|
16
16
|
end
|
17
17
|
|
18
18
|
##
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<nav id="skip-link" role="navigation" class="visually-hidden-focusable sr-only sr-only-focusable" aria-label="<%= t('blacklight.skip_links.label') %>">
|
2
2
|
<div class="container-xl">
|
3
|
-
<%= link_to_search %>
|
4
3
|
<%= link_to_main %>
|
4
|
+
<%= link_to_search %>
|
5
5
|
<%= content %>
|
6
6
|
</div>
|
7
7
|
</nav>
|
@@ -31,11 +31,25 @@ module Blacklight::DocumentHelperBehavior
|
|
31
31
|
# See: https://github.com/geoblacklight/geoblacklight/blob/7d3c31c7af3362879b97e2c1351a2496c728c59c/app/helpers/blacklight_helper.rb#L7
|
32
32
|
#
|
33
33
|
# @param [SolrDocument] document
|
34
|
+
# @deprecated
|
34
35
|
# @return [String]
|
35
36
|
def render_document_sidebar_partial(document)
|
37
|
+
unless @render_document_sidebar_partials_deprecation_warning_shown
|
38
|
+
partials = lookup_context.find_all('show_sidebar', lookup_context.prefixes, true, [], {})
|
39
|
+
unless partials.first.identifier.starts_with? Blacklight.root
|
40
|
+
Blacklight.deprecation.warn('The partial catalog/_show_sidebar.html.erb will not be rendered by #render_document_sidebar_partial in Blacklight 9.0.' \
|
41
|
+
'Configure blacklight_config.show.sidebar_component instead (default Blacklight::Search::SidebarComponent).')
|
42
|
+
@render_document_sidebar_partials_deprecation_warning_shown = true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
36
46
|
render 'show_sidebar', document: document
|
37
47
|
end
|
38
48
|
|
49
|
+
Blacklight.deprecation.deprecate_methods(self,
|
50
|
+
render_document_sidebar_partial: 'has been replaced by calling the sidebar component (Blacklight::Search::SidebarComponent) directly. ' \
|
51
|
+
'Set sidebar_component in the view config.')
|
52
|
+
|
39
53
|
##
|
40
54
|
# return the Bookmarks on a set of documents (all bookmarks on the page)
|
41
55
|
# @private
|
@@ -37,7 +37,9 @@ export default class CheckboxSubmit {
|
|
37
37
|
this.labelTarget.removeAttribute('disabled')
|
38
38
|
this.checkboxTarget.removeAttribute('disabled')
|
39
39
|
this.updateStateFor(!this.checked)
|
40
|
-
|
40
|
+
this.bookmarksCounter().forEach(counter => {
|
41
|
+
counter.innerHTML = json.bookmarks.count;
|
42
|
+
});
|
41
43
|
}).catch((error) => {
|
42
44
|
this.handleError(error)
|
43
45
|
})
|
@@ -63,8 +65,8 @@ export default class CheckboxSubmit {
|
|
63
65
|
return this.form.querySelector('[data-checkboxsubmit-target="span"]')
|
64
66
|
}
|
65
67
|
|
66
|
-
|
67
|
-
return document.
|
68
|
+
bookmarksCounter() {
|
69
|
+
return document.querySelectorAll('[data-role="bookmark-counter"]')
|
68
70
|
}
|
69
71
|
|
70
72
|
handleError() {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
const
|
1
|
+
const Core = function() {
|
2
2
|
const buffer = new Array;
|
3
3
|
return {
|
4
4
|
onLoad: function(func) {
|
@@ -34,13 +34,13 @@ const Blacklight = function() {
|
|
34
34
|
|
35
35
|
// turbolinks triggers page:load events on page transition
|
36
36
|
// If app isn't using turbolinks, this event will never be triggered, no prob.
|
37
|
-
|
37
|
+
Core.listeners().forEach(function(listener) {
|
38
38
|
document.addEventListener(listener, function() {
|
39
|
-
|
39
|
+
Core.activate()
|
40
40
|
})
|
41
41
|
})
|
42
42
|
|
43
|
-
|
43
|
+
Core.onLoad(function () {
|
44
44
|
const elem = document.querySelector('.no-js');
|
45
45
|
|
46
46
|
// The "no-js" class may already have been removed because this function is
|
@@ -52,4 +52,4 @@ Blacklight.onLoad(function () {
|
|
52
52
|
})
|
53
53
|
|
54
54
|
|
55
|
-
export default
|
55
|
+
export default Core
|
@@ -1,2 +1,3 @@
|
|
1
|
+
<% Blacklight.deprecation.warn('The partial catalog/_show_sidebar.html.erb will be removed in Blacklight 9.0. Configure blacklight_config.show.sidebar_component instead (default Blacklight::Search::SidebarComponent).') unless local_assigns[:silence_deprecation] %>
|
1
2
|
<% presenter = document_presenter(document) %>
|
2
3
|
<%= render presenter.view_config.sidebar_component.new(presenter: presenter) %>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<%= paginator.render do -%>
|
12
12
|
<ul class="pagination">
|
13
13
|
<%= prev_page_tag %>
|
14
|
-
<%= next_page_tag
|
14
|
+
<%= next_page_tag if Blacklight::Engine.config.blacklight.paginator[:next_page_position] == :before %>
|
15
15
|
<% each_relevant_page do |page| -%>
|
16
16
|
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
17
17
|
<%= page_tag page %>
|
@@ -19,5 +19,6 @@
|
|
19
19
|
<%= gap_tag %>
|
20
20
|
<% end -%>
|
21
21
|
<% end -%>
|
22
|
+
<%= next_page_tag if Blacklight::Engine.config.blacklight.paginator[:next_page_position] == :after %>
|
22
23
|
</ul>
|
23
24
|
<% end -%>
|
@@ -18,7 +18,6 @@
|
|
18
18
|
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
|
19
19
|
<% else %>
|
20
20
|
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
|
21
|
-
<%= javascript_include_tag "blacklight/blacklight", type: 'module' %>
|
22
21
|
<script type="module">
|
23
22
|
import githubAutoCompleteElement from 'https://cdn.skypack.dev/@github/auto-complete-element';
|
24
23
|
</script>
|
data/blacklight.gemspec
CHANGED
@@ -31,11 +31,11 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
|
32
32
|
s.add_dependency "i18n", '>= 1.7.0' # added named parameters
|
33
33
|
s.add_dependency "ostruct", '>= 0.3.2'
|
34
|
-
s.add_dependency "view_component", '>= 2.
|
34
|
+
s.add_dependency "view_component", '>= 2.74', '< 4'
|
35
35
|
s.add_dependency "zeitwerk"
|
36
36
|
|
37
37
|
s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
|
38
|
-
s.add_development_dependency "rspec-rails", "
|
38
|
+
s.add_development_dependency "rspec-rails", ">= 6.1", "< 8"
|
39
39
|
s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
|
40
40
|
s.add_development_dependency 'axe-core-rspec'
|
41
41
|
s.add_development_dependency "capybara", '~> 3'
|
data/lib/blacklight/component.rb
CHANGED
@@ -3,57 +3,20 @@
|
|
3
3
|
module Blacklight
|
4
4
|
class Component < ViewComponent::Base
|
5
5
|
class << self
|
6
|
-
|
7
|
-
def config
|
8
|
-
@config ||= ViewComponent::Config.defaults.merge(ViewComponent::Base.config)
|
9
|
-
end
|
6
|
+
alias upstream_sidecar_files sidecar_files
|
10
7
|
|
11
|
-
|
12
|
-
|
13
|
-
@__vc_compiler ||= EngineCompiler.new(self)
|
8
|
+
def reset_compiler!
|
9
|
+
@__vc_compiler = nil
|
14
10
|
end
|
15
|
-
# rubocop:enable Naming/MemoizedInstanceVariableName
|
16
|
-
|
17
|
-
alias sidecar_files _sidecar_files unless ViewComponent::Base.respond_to? :sidecar_files
|
18
|
-
end
|
19
|
-
|
20
|
-
EXCLUDE_VARIABLES = [
|
21
|
-
:@lookup_context, :@view_renderer, :@view_flow, :@view_context,
|
22
|
-
:@tag_builder, :@current_template,
|
23
|
-
:@__vc_set_slots, :@__vc_original_view_context,
|
24
|
-
:@__vc_variant, :@__vc_content_evaluated,
|
25
|
-
:@__vc_render_in_block, :@__vc_content, :@__vc_helpers
|
26
|
-
].freeze
|
27
|
-
|
28
|
-
def inspect
|
29
|
-
# Exclude variables added by render_in
|
30
|
-
render_variables = instance_variables - EXCLUDE_VARIABLES
|
31
|
-
fields = render_variables.map { |ivar| "#{ivar}:#{instance_variable_get(ivar).inspect}" }.join(', ')
|
32
|
-
"#<#{self.class.name}:#{object_id} #{fields}>"
|
33
|
-
end
|
34
|
-
|
35
|
-
class EngineCompiler < ::ViewComponent::Compiler
|
36
|
-
# ViewComponent::Compiler locates and caches templates from sidecar files to the component source file.
|
37
|
-
# While this is sensible in a Rails application, it prevents component templates defined in an Engine
|
38
|
-
# from being overridden by an installing application without subclassing the component, which may also
|
39
|
-
# require modifying any partials rendering the component. This subclass of compiler overrides the template
|
40
|
-
# location algorithm to take the sidecar file names from the Engine, but look to see if a file of the
|
41
|
-
# same name existing in the installing application (ie, under Rails.root). If the latter exists, this
|
42
|
-
# compiler will cache that template instead of the engine-defined file; if not, the compiler will fall
|
43
|
-
# back to the engine-defined file.
|
44
|
-
def templates
|
45
|
-
@templates ||= begin
|
46
|
-
extensions = ActionView::Template.template_handler_extensions
|
47
11
|
|
48
|
-
|
49
|
-
|
50
|
-
|
12
|
+
def sidecar_files(*args, **kwargs)
|
13
|
+
upstream_sidecar_files(*args, **kwargs).map do |path|
|
14
|
+
app_path = Rails.root.join(path.slice(path.index(view_component_path)..-1).to_s).to_s
|
51
15
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
16
|
+
if File.exist?(app_path)
|
17
|
+
app_path
|
18
|
+
else
|
19
|
+
path
|
57
20
|
end
|
58
21
|
end
|
59
22
|
end
|
data/lib/blacklight/engine.rb
CHANGED
@@ -72,6 +72,12 @@ module Blacklight
|
|
72
72
|
outer_window: 2
|
73
73
|
}
|
74
74
|
|
75
|
+
# Blacklight 9 moves the next button after the page numbers. This behavior can be configured
|
76
|
+
# in Blacklight 8 by setting the next_button_position to :after
|
77
|
+
bl_global_config.paginator = {
|
78
|
+
next_button_position: :before
|
79
|
+
}
|
80
|
+
|
75
81
|
bl_global_config.search_params_permitted_classes = [ActiveSupport::HashWithIndifferentAccess, Symbol]
|
76
82
|
|
77
83
|
# Anything that goes into Blacklight::Engine.config is stored as a class
|
@@ -42,6 +42,8 @@ module Blacklight
|
|
42
42
|
" self.string_display_key ||= :email\n"
|
43
43
|
end
|
44
44
|
gsub_file("config/initializers/devise.rb", "config.sign_out_via = :delete", "config.sign_out_via = :get")
|
45
|
+
# Work around for https://github.com/heartcombo/devise/issues/5720
|
46
|
+
gsub_file("config/initializers/devise.rb", "# config.reload_routes = true", "config.reload_routes = false")
|
45
47
|
end
|
46
48
|
|
47
49
|
# Add Blacklight to the user model
|
data/package.json
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "blacklight-frontend",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.5.0",
|
4
4
|
"description": "The frontend code and styles for Blacklight",
|
5
5
|
"main": "app/assets/javascripts/blacklight",
|
6
|
+
"type": "module",
|
6
7
|
"module": "app/assets/javascripts/blacklight/blacklight.esm.js",
|
7
8
|
"scripts": {
|
8
9
|
"prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
|
@@ -22,7 +23,7 @@
|
|
22
23
|
},
|
23
24
|
"homepage": "https://github.com/projectblacklight/blacklight#readme",
|
24
25
|
"devDependencies": {
|
25
|
-
"rollup": "^
|
26
|
+
"rollup": "^4.24.0",
|
26
27
|
"rollup-plugin-includepaths": "^0.2.4"
|
27
28
|
},
|
28
29
|
"browserslist": [
|
data/rollup.config.js
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
1
|
import includePaths from 'rollup-plugin-includepaths';
|
4
2
|
|
5
|
-
const path = require('path')
|
6
3
|
|
7
4
|
const BUNDLE = process.env.BUNDLE === 'true'
|
8
5
|
const ESM = process.env.ESM === 'true'
|
@@ -19,19 +16,16 @@ let includePathOptions = {
|
|
19
16
|
};
|
20
17
|
|
21
18
|
const rollupConfig = {
|
22
|
-
input:
|
19
|
+
input: 'app/javascript/blacklight/index.js',
|
23
20
|
output: {
|
24
|
-
file:
|
25
|
-
format: ESM ? '
|
21
|
+
file: `app/assets/javascripts/blacklight/${fileDest}.js`,
|
22
|
+
format: ESM ? 'es' : 'umd',
|
26
23
|
globals,
|
27
|
-
generatedCode: 'es2015'
|
24
|
+
generatedCode: { preset: 'es2015' },
|
25
|
+
name: ESM ? undefined : 'Blacklight'
|
28
26
|
},
|
29
27
|
external,
|
30
28
|
plugins: [includePaths(includePathOptions)]
|
31
29
|
}
|
32
30
|
|
33
|
-
|
34
|
-
rollupConfig.output.name = 'Blacklight'
|
35
|
-
}
|
36
|
-
|
37
|
-
module.exports = rollupConfig
|
31
|
+
export default rollupConfig
|
@@ -7,7 +7,7 @@ RSpec.describe Blacklight::SearchContext::ServerItemPaginationComponent, type: :
|
|
7
7
|
|
8
8
|
let(:current_document_id) { 9 }
|
9
9
|
let(:current_document) { SolrDocument.new(id: current_document_id) }
|
10
|
-
let(:search_session) { { 'document_id' => current_document_id } }
|
10
|
+
let(:search_session) { { 'document_id' => current_document_id, 'counter' => 1, 'total' => '3' } }
|
11
11
|
let(:instance) { described_class.new(search_context: search_context, search_session: search_session, current_document: current_document) }
|
12
12
|
|
13
13
|
before do
|
@@ -23,6 +23,17 @@ RSpec.describe Blacklight::SearchContext::ServerItemPaginationComponent, type: :
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
context 'when there is exactly one search result with no next or previous document' do
|
27
|
+
let(:search_context) { { prev: nil, next: nil } }
|
28
|
+
let(:search_session) { { 'document_id' => current_document_id, 'counter' => 1, 'total' => '1' } }
|
29
|
+
|
30
|
+
it "renders single page count" do
|
31
|
+
expect(render.to_html).to include '<strong>1</strong> of <strong>1</strong>'
|
32
|
+
expect(render.css('span.previous').to_html).to be_blank
|
33
|
+
expect(render.css('span.next').to_html).to be_blank
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
26
37
|
context 'when there is next and previous' do
|
27
38
|
let(:search_context) { { next: next_doc, prev: prev_doc } }
|
28
39
|
let(:prev_doc) { SolrDocument.new(id: '777') }
|
@@ -47,9 +47,10 @@ RSpec.describe "Search Results context" do
|
|
47
47
|
search_for ''
|
48
48
|
expect(page).to have_content "1 - 10"
|
49
49
|
find_all('.index_title a').last.click
|
50
|
+
expect(page).to have_css "h1", text: "Pluvial nectar"
|
50
51
|
click_on "Next »"
|
51
52
|
|
52
|
-
expect(page).to
|
53
|
+
expect(page).to have_css "h1", text: "Naqdī barā-yi tamām-i"
|
53
54
|
click_on "Back to Search"
|
54
55
|
expect(page).to have_content "11 - 20"
|
55
56
|
end
|
@@ -1,43 +1,48 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe Blacklight::Component do
|
4
|
-
let(:component_class) { Blacklight::
|
3
|
+
RSpec.describe Blacklight::Component, type: :component do
|
4
|
+
let(:component_class) { Blacklight::System::ModalComponent }
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
before do
|
7
|
+
component_class.reset_compiler!
|
8
|
+
ViewComponent::CompileCache.invalidate!
|
9
|
+
|
10
|
+
component_class.class_eval do
|
11
|
+
undef :call if method_defined?(:call)
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
after do
|
16
|
+
component_class.reset_compiler!
|
17
|
+
ViewComponent::CompileCache.invalidate!
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
component_class.class_eval do
|
20
|
+
undef :call if method_defined?(:call)
|
21
|
+
end
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
24
|
+
context "without overrides" do
|
25
|
+
it "renders the engine template" do
|
26
|
+
render_inline(component_class.new)
|
27
|
+
expect(page).to have_css('.modal-header')
|
25
28
|
end
|
29
|
+
end
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
|
31
|
+
context "with overrides" do
|
32
|
+
around do |ex|
|
33
|
+
FileUtils.mkdir_p(Rails.root.join('app/components/blacklight/system'))
|
34
|
+
Rails.root.join("app/components/blacklight/system/modal_component.html.erb").open("w") do |f|
|
35
|
+
f.puts '<div class="custom-modal">Overridden</div>'
|
30
36
|
end
|
31
37
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
38
|
+
ex.run
|
39
|
+
ensure
|
40
|
+
Rails.root.join('app/components/blacklight/system/modal_component.html.erb').unlink
|
41
|
+
end
|
36
42
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
43
|
+
it "renders to application template" do
|
44
|
+
render_inline(component_class.new)
|
45
|
+
expect(page).to have_css('.custom-modal')
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -49,8 +49,11 @@ RSpec.configure do |config|
|
|
49
49
|
# When we're testing the API, only run the api tests
|
50
50
|
config.filter_run api: true if ENV['BLACKLIGHT_API_TEST'].present?
|
51
51
|
|
52
|
-
|
53
|
-
|
52
|
+
if Rails.version.to_f >= 7.1
|
53
|
+
config.fixture_paths = [Rails.root.join("spec/fixtures")]
|
54
|
+
else
|
55
|
+
config.fixture_path = Rails.root.join("spec/fixtures")
|
56
|
+
end
|
54
57
|
|
55
58
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
56
59
|
# examples within a transaction, remove the following line or assign false
|
data/tasks/blacklight.rake
CHANGED
@@ -24,7 +24,7 @@ def with_solr(&block)
|
|
24
24
|
# We're being invoked by the app entrypoint script and solr is already up via docker compose
|
25
25
|
if ENV['SOLR_ENV'] == 'docker-compose'
|
26
26
|
yield
|
27
|
-
elsif system('docker compose
|
27
|
+
elsif system('docker compose version')
|
28
28
|
# We're not running `docker compose up' but still want to use a docker instance of solr.
|
29
29
|
begin
|
30
30
|
puts "Starting Solr"
|
@@ -47,7 +47,7 @@ task ci: ['build:npm'] do
|
|
47
47
|
with_solr do
|
48
48
|
Rake::Task['blacklight:internal:seed'].invoke
|
49
49
|
within_test_app do
|
50
|
-
# Precompiles the
|
50
|
+
# Precompiles the assets
|
51
51
|
system "bin/rake spec:prepare"
|
52
52
|
end
|
53
53
|
Rake::Task['blacklight:coverage'].invoke
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: exe
|
19
19
|
cert_chain: []
|
20
|
-
date: 2024-
|
20
|
+
date: 2024-10-23 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
requirements:
|
116
116
|
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '2.
|
118
|
+
version: '2.74'
|
119
119
|
- - "<"
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '4'
|
@@ -125,7 +125,7 @@ dependencies:
|
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: '2.
|
128
|
+
version: '2.74'
|
129
129
|
- - "<"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '4'
|
@@ -167,16 +167,22 @@ dependencies:
|
|
167
167
|
name: rspec-rails
|
168
168
|
requirement: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
|
-
- - "
|
170
|
+
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '6.1'
|
173
|
+
- - "<"
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '8'
|
173
176
|
type: :development
|
174
177
|
prerelease: false
|
175
178
|
version_requirements: !ruby/object:Gem::Requirement
|
176
179
|
requirements:
|
177
|
-
- - "
|
180
|
+
- - ">="
|
178
181
|
- !ruby/object:Gem::Version
|
179
182
|
version: '6.1'
|
183
|
+
- - "<"
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '8'
|
180
186
|
- !ruby/object:Gem::Dependency
|
181
187
|
name: rspec-collection_matchers
|
182
188
|
requirement: !ruby/object:Gem::Requirement
|
@@ -994,7 +1000,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
994
1000
|
- !ruby/object:Gem::Version
|
995
1001
|
version: '0'
|
996
1002
|
requirements: []
|
997
|
-
rubygems_version: 3.5.
|
1003
|
+
rubygems_version: 3.5.9
|
998
1004
|
signing_key:
|
999
1005
|
specification_version: 4
|
1000
1006
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|