blacklight 8.0.0.beta6 → 8.0.0.beta7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/blacklight.esm.js +376 -0
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -0
- data/app/assets/javascripts/blacklight/blacklight.js +384 -0
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -0
- data/blacklight.gemspec +1 -1
- data/package.json +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0662c318e51fa886e7bb99d4e1b92fe25475758a713f3cb294b1db20cdde838f
|
4
|
+
data.tar.gz: d5478a9723172b23520d55b0550b23c8b57d7f72aa26e5844e837f13cbc43cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0818d78cb403856c00378967fdad5ce88ee63fe1cfbff4c22dc09b1dd9eaf29dc04834d4575f71b52a66a0fa227a47d059f3a5c519d38f34909c5c0f8e45362d'
|
7
|
+
data.tar.gz: 0566a3bc3a8ee90b05529d22819d9cca9253ff1c6ecedb300eb49b55a117c0735ffbcace049cf280f1bd13220be42ee80fd74794ec2fa402457b9bb9ec2801e5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
8.0.0.
|
1
|
+
8.0.0.beta7
|
@@ -0,0 +1,376 @@
|
|
1
|
+
/* Converts a "toggle" form, with single submit button to add/remove
|
2
|
+
something, like used for Bookmarks, into an AJAXy checkbox instead.
|
3
|
+
Apply to a form. Does require certain assumption about the form:
|
4
|
+
1) The same form 'action' href must be used for both ADD and REMOVE
|
5
|
+
actions, with the different being the hidden input name="_method"
|
6
|
+
being set to "put" or "delete" -- that's the Rails method to pretend
|
7
|
+
to be doing a certain HTTP verb. So same URL, PUT to add, DELETE
|
8
|
+
to remove. This plugin assumes that.
|
9
|
+
Plus, the form this is applied to should provide a data-doc-id
|
10
|
+
attribute (HTML5-style doc-*) that contains the id/primary key
|
11
|
+
of the object in question -- used by plugin for a unique value for
|
12
|
+
DOM id's.
|
13
|
+
Uses HTML for a checkbox compatible with Bootstrap 4.
|
14
|
+
new CheckboxSubmit(document.querySelector('form.something')).render()
|
15
|
+
*/
|
16
|
+
class CheckboxSubmit {
|
17
|
+
constructor(form) {
|
18
|
+
this.form = form;
|
19
|
+
}
|
20
|
+
|
21
|
+
async clicked(evt) {
|
22
|
+
this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress');
|
23
|
+
this.labelTarget.setAttribute('disabled', 'disabled');
|
24
|
+
this.checkboxTarget.setAttribute('disabled', 'disabled');
|
25
|
+
const response = await fetch(this.formTarget.getAttribute('action'), {
|
26
|
+
body: new FormData(this.formTarget),
|
27
|
+
method: this.formTarget.getAttribute('method').toUpperCase(),
|
28
|
+
headers: {
|
29
|
+
'Accept': 'application/json',
|
30
|
+
'X-Requested-With': 'XMLHttpRequest',
|
31
|
+
'X-CSRF-Token': document.querySelector('meta[name=csrf-token]')?.content
|
32
|
+
}
|
33
|
+
});
|
34
|
+
this.labelTarget.removeAttribute('disabled');
|
35
|
+
this.checkboxTarget.removeAttribute('disabled');
|
36
|
+
if (response.ok) {
|
37
|
+
const json = await response.json();
|
38
|
+
this.updateStateFor(!this.checked);
|
39
|
+
document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count;
|
40
|
+
} else {
|
41
|
+
alert('Error');
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
get checked() {
|
46
|
+
return (this.form.querySelectorAll('input[name=_method][value=delete]').length != 0)
|
47
|
+
}
|
48
|
+
|
49
|
+
get formTarget() {
|
50
|
+
return this.form
|
51
|
+
}
|
52
|
+
|
53
|
+
get labelTarget() {
|
54
|
+
return this.form.querySelector('[data-checkboxsubmit-target="label"]')
|
55
|
+
}
|
56
|
+
|
57
|
+
get checkboxTarget() {
|
58
|
+
return this.form.querySelector('[data-checkboxsubmit-target="checkbox"]')
|
59
|
+
}
|
60
|
+
|
61
|
+
get spanTarget() {
|
62
|
+
return this.form.querySelector('[data-checkboxsubmit-target="span"]')
|
63
|
+
}
|
64
|
+
|
65
|
+
updateStateFor(state) {
|
66
|
+
this.checkboxTarget.checked = state;
|
67
|
+
|
68
|
+
if (state) {
|
69
|
+
this.labelTarget.classList.add('checked');
|
70
|
+
//Set the Rails hidden field that fakes an HTTP verb
|
71
|
+
//properly for current state action.
|
72
|
+
this.formTarget.querySelector('input[name=_method]').value = 'delete';
|
73
|
+
this.spanTarget.innerHTML = this.form.getAttribute('data-present');
|
74
|
+
} else {
|
75
|
+
this.labelTarget.classList.remove('checked');
|
76
|
+
this.formTarget.querySelector('input[name=_method]').value = 'put';
|
77
|
+
this.spanTarget.innerHTML = this.form.getAttribute('data-absent');
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
const BookmarkToggle = (e) => {
|
83
|
+
if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) {
|
84
|
+
const form = e.target.closest('form');
|
85
|
+
if (form) new CheckboxSubmit(form).clicked(e);
|
86
|
+
}
|
87
|
+
};
|
88
|
+
|
89
|
+
document.addEventListener('click', BookmarkToggle);
|
90
|
+
|
91
|
+
const ButtonFocus = (e) => {
|
92
|
+
// Button clicks should change focus. As of 10/3/19, Firefox for Mac and
|
93
|
+
// Safari both do not set focus to a button on button click.
|
94
|
+
// See https://zellwk.com/blog/inconsistent-button-behavior/ for background information
|
95
|
+
if (e.target.matches('[data-toggle="collapse"]') || e.target.matches('[data-bs-toggle="collapse"]')) {
|
96
|
+
e.target.focus();
|
97
|
+
}
|
98
|
+
};
|
99
|
+
|
100
|
+
document.addEventListener('click', ButtonFocus);
|
101
|
+
|
102
|
+
/*
|
103
|
+
The blacklight modal plugin can display some interactions inside a Bootstrap
|
104
|
+
modal window, including some multi-page interactions.
|
105
|
+
|
106
|
+
It supports unobtrusive Javascript, where a link or form that would have caused
|
107
|
+
a new page load is changed to display it's results inside a modal dialog,
|
108
|
+
by this plugin. The plugin assumes there is a Bootstrap modal div
|
109
|
+
on the page with id #blacklight-modal to use as the modal -- the standard Blacklight
|
110
|
+
layout provides this.
|
111
|
+
|
112
|
+
To make a link or form have their results display inside a modal, add
|
113
|
+
`data-blacklight-modal="trigger"` to the link or form. (Note, form itself not submit input)
|
114
|
+
With Rails link_to helper, you'd do that like:
|
115
|
+
|
116
|
+
link_to something, link, data: { blacklight_modal: "trigger" }
|
117
|
+
|
118
|
+
The results of the link href or form submit will be displayed inside
|
119
|
+
a modal -- they should include the proper HTML markup for a bootstrap modal's
|
120
|
+
contents. Also, you ordinarily won't want the Rails template with wrapping
|
121
|
+
navigational elements to be used. The Rails controller could suppress
|
122
|
+
the layout when a JS AJAX request is detected, OR the response
|
123
|
+
can include a `<div data-blacklight-modal="container">` -- only the contents
|
124
|
+
of the container will be placed inside the modal, the rest of the
|
125
|
+
page will be ignored.
|
126
|
+
|
127
|
+
Link or forms inside the modal will ordinarily cause page loads
|
128
|
+
when they are triggered. However, if you'd like their results
|
129
|
+
to stay within the modal, just add `data-blacklight-modal="preserve"`
|
130
|
+
to the link or form.
|
131
|
+
|
132
|
+
Here's an example of what might be returned, demonstrating most of the devices available:
|
133
|
+
|
134
|
+
<div data-blacklight-modal="container">
|
135
|
+
<div class="modal-header">
|
136
|
+
<button type="button" class="close" data-bl-dismiss="modal" aria-hidden="true">×</button>
|
137
|
+
<h3 class="modal-title">Request Placed</h3>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div class="modal-body">
|
141
|
+
<p>Some message</p>
|
142
|
+
<%= link_to "This result will still be within modal", some_link, data: { blacklight_modal: "preserve" } %>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
<div class="modal-footer">
|
147
|
+
<button type="button" class="btn btn-secondary" data-bl-dismiss="modal">Close</button>
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
|
152
|
+
One additional feature. If the content returned from the AJAX form submission
|
153
|
+
can be a turbo-stream that defines some HTML fragementsand where on the page to put them:
|
154
|
+
https://turbo.hotwired.dev/handbook/streams
|
155
|
+
*/
|
156
|
+
|
157
|
+
const Modal = (() => {
|
158
|
+
const modal = {};
|
159
|
+
|
160
|
+
// a Bootstrap modal div that should be already on the page hidden
|
161
|
+
modal.modalSelector = '#blacklight-modal';
|
162
|
+
|
163
|
+
// Trigger selectors identify forms or hyperlinks that should open
|
164
|
+
// inside a modal dialog.
|
165
|
+
modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';
|
166
|
+
|
167
|
+
// preserve selectors identify forms or hyperlinks that, if activated already
|
168
|
+
// inside a modal dialog, should have destinations remain inside the modal -- but
|
169
|
+
// won't trigger a modal if not already in one.
|
170
|
+
//
|
171
|
+
// No need to repeat selectors from trigger selectors, those will already
|
172
|
+
// be preserved. MUST be manually prefixed with the modal selector,
|
173
|
+
// so they only apply to things inside a modal.
|
174
|
+
modal.preserveLinkSelector = modal.modalSelector + ' a[data-blacklight-modal~=preserve]';
|
175
|
+
|
176
|
+
modal.containerSelector = '[data-blacklight-modal~=container]';
|
177
|
+
|
178
|
+
// Called on fatal failure of ajax load, function returns content
|
179
|
+
// to show to user in modal. Right now called only for network errors.
|
180
|
+
modal.onFailure = function (error) {
|
181
|
+
console.error('Server error:', this.url, error);
|
182
|
+
|
183
|
+
const contents = `<div class="modal-header">
|
184
|
+
<div class="modal-title">There was a problem with your request.</div>
|
185
|
+
<button type="button" class="blacklight-modal-close btn-close close" data-bl-dismiss="modal" aria-label="Close">
|
186
|
+
<span aria-hidden="true" class="visually-hidden">×</span>
|
187
|
+
</button>
|
188
|
+
</div>
|
189
|
+
<div class="modal-body">
|
190
|
+
<p>Expected a successful response from the server, but got an error</p>
|
191
|
+
<pre>${this.url}\n${error}</pre>
|
192
|
+
</div>`;
|
193
|
+
|
194
|
+
document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents;
|
195
|
+
|
196
|
+
modal.show();
|
197
|
+
};
|
198
|
+
|
199
|
+
// Add the passed in contents to the modal and display it.
|
200
|
+
modal.receiveAjax = function (contents) {
|
201
|
+
const domparser = new DOMParser();
|
202
|
+
const dom = domparser.parseFromString(contents, "text/html");
|
203
|
+
// If there is a containerSelector on the document, use its children.
|
204
|
+
let elements = dom.querySelectorAll(`${modal.containerSelector} > *`);
|
205
|
+
if (elements.length == 0) {
|
206
|
+
// If the containerSelector wasn't found, use the whole document
|
207
|
+
elements = dom.body.childNodes;
|
208
|
+
}
|
209
|
+
|
210
|
+
document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(...elements);
|
211
|
+
|
212
|
+
modal.show();
|
213
|
+
};
|
214
|
+
|
215
|
+
|
216
|
+
modal.modalAjaxLinkClick = function(e) {
|
217
|
+
e.preventDefault();
|
218
|
+
const href = e.target.getAttribute('href');
|
219
|
+
fetch(href)
|
220
|
+
.then(response => {
|
221
|
+
if (!response.ok) {
|
222
|
+
throw new TypeError("Request failed");
|
223
|
+
}
|
224
|
+
return response.text();
|
225
|
+
})
|
226
|
+
.then(data => modal.receiveAjax(data))
|
227
|
+
.catch(error => modal.onFailure(error));
|
228
|
+
};
|
229
|
+
|
230
|
+
modal.setupModal = function() {
|
231
|
+
// Register both trigger and preserve selectors in ONE event handler, combining
|
232
|
+
// into one selector with a comma, so if something matches BOTH selectors, it
|
233
|
+
// still only gets the event handler called once.
|
234
|
+
document.addEventListener('click', (e) => {
|
235
|
+
if (e.target.closest(`${modal.triggerLinkSelector}, ${modal.preserveLinkSelector}`))
|
236
|
+
modal.modalAjaxLinkClick(e);
|
237
|
+
else if (e.target.closest('[data-bl-dismiss="modal"]'))
|
238
|
+
modal.hide();
|
239
|
+
});
|
240
|
+
};
|
241
|
+
|
242
|
+
modal.hide = function (el) {
|
243
|
+
const dom = document.querySelector(modal.modalSelector);
|
244
|
+
|
245
|
+
if (!dom.open) return
|
246
|
+
dom.close();
|
247
|
+
};
|
248
|
+
|
249
|
+
modal.show = function(el) {
|
250
|
+
const dom = document.querySelector(modal.modalSelector);
|
251
|
+
|
252
|
+
if (dom.open) return
|
253
|
+
dom.showModal();
|
254
|
+
};
|
255
|
+
|
256
|
+
modal.setupModal();
|
257
|
+
|
258
|
+
return modal;
|
259
|
+
})();
|
260
|
+
|
261
|
+
const SearchContext = (e) => {
|
262
|
+
if (e.target.matches('[data-context-href]')) {
|
263
|
+
SearchContext.handleSearchContextMethod.call(e.target, e);
|
264
|
+
}
|
265
|
+
};
|
266
|
+
|
267
|
+
SearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content;
|
268
|
+
SearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content;
|
269
|
+
|
270
|
+
// this is the Rails.handleMethod with a couple adjustments, described inline:
|
271
|
+
// first, we're attaching this directly to the event handler, so we can check for meta-keys
|
272
|
+
SearchContext.handleSearchContextMethod = function(event) {
|
273
|
+
const link = this;
|
274
|
+
|
275
|
+
// instead of using the normal href, we need to use the context href instead
|
276
|
+
let href = link.getAttribute('data-context-href');
|
277
|
+
let target = link.getAttribute('target');
|
278
|
+
let csrfToken = SearchContext.csrfToken();
|
279
|
+
let csrfParam = SearchContext.csrfParam();
|
280
|
+
let form = document.createElement('form');
|
281
|
+
form.method = 'post';
|
282
|
+
form.action = href;
|
283
|
+
|
284
|
+
|
285
|
+
let formContent = `<input name="_method" value="post" type="hidden" />
|
286
|
+
<input name="redirect" value="${link.getAttribute('href')}" type="hidden" />`;
|
287
|
+
|
288
|
+
// check for meta keys.. if set, we should open in a new tab
|
289
|
+
if(event.metaKey || event.ctrlKey) {
|
290
|
+
target = '_blank';
|
291
|
+
}
|
292
|
+
|
293
|
+
if (csrfParam !== undefined && csrfToken !== undefined) {
|
294
|
+
formContent += `<input name="${csrfParam}" value="${csrfToken}" type="hidden" />`;
|
295
|
+
}
|
296
|
+
|
297
|
+
// Must trigger submit by click on a button, else "submit" event handler won't work!
|
298
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
|
299
|
+
formContent += '<input type="submit" />';
|
300
|
+
|
301
|
+
if (target) { form.setAttribute('target', target); }
|
302
|
+
|
303
|
+
form.style.display = 'none';
|
304
|
+
form.innerHTML = formContent;
|
305
|
+
document.body.appendChild(form);
|
306
|
+
form.querySelector('[type="submit"]').click();
|
307
|
+
|
308
|
+
event.preventDefault();
|
309
|
+
};
|
310
|
+
|
311
|
+
document.addEventListener('click', SearchContext);
|
312
|
+
|
313
|
+
const Blacklight = function() {
|
314
|
+
const buffer = new Array;
|
315
|
+
return {
|
316
|
+
onLoad: function(func) {
|
317
|
+
buffer.push(func);
|
318
|
+
},
|
319
|
+
|
320
|
+
activate: function() {
|
321
|
+
for(let i = 0; i < buffer.length; i++) {
|
322
|
+
buffer[i].call();
|
323
|
+
}
|
324
|
+
},
|
325
|
+
|
326
|
+
listeners: function () {
|
327
|
+
const listeners = [];
|
328
|
+
if (typeof Turbo !== 'undefined') {
|
329
|
+
listeners.push('turbo:load', 'turbo:frame-load');
|
330
|
+
} else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
|
331
|
+
// Turbolinks 5
|
332
|
+
if (Turbolinks.BrowserAdapter) {
|
333
|
+
listeners.push('turbolinks:load');
|
334
|
+
} else {
|
335
|
+
// Turbolinks < 5
|
336
|
+
listeners.push('page:load', 'DOMContentLoaded');
|
337
|
+
}
|
338
|
+
} else {
|
339
|
+
listeners.push('DOMContentLoaded');
|
340
|
+
}
|
341
|
+
|
342
|
+
return listeners;
|
343
|
+
}
|
344
|
+
};
|
345
|
+
}();
|
346
|
+
|
347
|
+
// turbolinks triggers page:load events on page transition
|
348
|
+
// If app isn't using turbolinks, this event will never be triggered, no prob.
|
349
|
+
Blacklight.listeners().forEach(function(listener) {
|
350
|
+
document.addEventListener(listener, function() {
|
351
|
+
Blacklight.activate();
|
352
|
+
});
|
353
|
+
});
|
354
|
+
|
355
|
+
Blacklight.onLoad(function () {
|
356
|
+
const elem = document.querySelector('.no-js');
|
357
|
+
|
358
|
+
// The "no-js" class may already have been removed because this function is
|
359
|
+
// run on every turbo:load event, in that case, it won't find an element.
|
360
|
+
if (!elem) return;
|
361
|
+
|
362
|
+
elem.classList.remove('no-js');
|
363
|
+
elem.classList.add('js');
|
364
|
+
});
|
365
|
+
|
366
|
+
const index = {
|
367
|
+
BookmarkToggle,
|
368
|
+
ButtonFocus,
|
369
|
+
Modal,
|
370
|
+
SearchContext,
|
371
|
+
Core: Blacklight,
|
372
|
+
onLoad: Blacklight.onLoad
|
373
|
+
};
|
374
|
+
|
375
|
+
export { index as default };
|
376
|
+
//# sourceMappingURL=blacklight.esm.js.map
|
@@ -0,0 +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 async clicked(evt) {\n this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress')\n this.labelTarget.setAttribute('disabled', 'disabled');\n this.checkboxTarget.setAttribute('disabled', 'disabled');\n const response = await 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 })\n this.labelTarget.removeAttribute('disabled')\n this.checkboxTarget.removeAttribute('disabled')\n if (response.ok) {\n const json = await response.json()\n this.updateStateFor(!this.checked)\n document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count\n } else {\n alert('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 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 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 if (elements.length == 0) {\n // If the containerSelector wasn't found, use the whole document\n elements = dom.body.childNodes\n }\n\n document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(...elements)\n\n modal.show();\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 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;A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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;;;;"}
|
@@ -0,0 +1,384 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
3
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Blacklight = factory());
|
5
|
+
})(this, (function () { 'use strict';
|
6
|
+
|
7
|
+
/* Converts a "toggle" form, with single submit button to add/remove
|
8
|
+
something, like used for Bookmarks, into an AJAXy checkbox instead.
|
9
|
+
Apply to a form. Does require certain assumption about the form:
|
10
|
+
1) The same form 'action' href must be used for both ADD and REMOVE
|
11
|
+
actions, with the different being the hidden input name="_method"
|
12
|
+
being set to "put" or "delete" -- that's the Rails method to pretend
|
13
|
+
to be doing a certain HTTP verb. So same URL, PUT to add, DELETE
|
14
|
+
to remove. This plugin assumes that.
|
15
|
+
Plus, the form this is applied to should provide a data-doc-id
|
16
|
+
attribute (HTML5-style doc-*) that contains the id/primary key
|
17
|
+
of the object in question -- used by plugin for a unique value for
|
18
|
+
DOM id's.
|
19
|
+
Uses HTML for a checkbox compatible with Bootstrap 4.
|
20
|
+
new CheckboxSubmit(document.querySelector('form.something')).render()
|
21
|
+
*/
|
22
|
+
class CheckboxSubmit {
|
23
|
+
constructor(form) {
|
24
|
+
this.form = form;
|
25
|
+
}
|
26
|
+
|
27
|
+
async clicked(evt) {
|
28
|
+
this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress');
|
29
|
+
this.labelTarget.setAttribute('disabled', 'disabled');
|
30
|
+
this.checkboxTarget.setAttribute('disabled', 'disabled');
|
31
|
+
const response = await fetch(this.formTarget.getAttribute('action'), {
|
32
|
+
body: new FormData(this.formTarget),
|
33
|
+
method: this.formTarget.getAttribute('method').toUpperCase(),
|
34
|
+
headers: {
|
35
|
+
'Accept': 'application/json',
|
36
|
+
'X-Requested-With': 'XMLHttpRequest',
|
37
|
+
'X-CSRF-Token': document.querySelector('meta[name=csrf-token]')?.content
|
38
|
+
}
|
39
|
+
});
|
40
|
+
this.labelTarget.removeAttribute('disabled');
|
41
|
+
this.checkboxTarget.removeAttribute('disabled');
|
42
|
+
if (response.ok) {
|
43
|
+
const json = await response.json();
|
44
|
+
this.updateStateFor(!this.checked);
|
45
|
+
document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count;
|
46
|
+
} else {
|
47
|
+
alert('Error');
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
get checked() {
|
52
|
+
return (this.form.querySelectorAll('input[name=_method][value=delete]').length != 0)
|
53
|
+
}
|
54
|
+
|
55
|
+
get formTarget() {
|
56
|
+
return this.form
|
57
|
+
}
|
58
|
+
|
59
|
+
get labelTarget() {
|
60
|
+
return this.form.querySelector('[data-checkboxsubmit-target="label"]')
|
61
|
+
}
|
62
|
+
|
63
|
+
get checkboxTarget() {
|
64
|
+
return this.form.querySelector('[data-checkboxsubmit-target="checkbox"]')
|
65
|
+
}
|
66
|
+
|
67
|
+
get spanTarget() {
|
68
|
+
return this.form.querySelector('[data-checkboxsubmit-target="span"]')
|
69
|
+
}
|
70
|
+
|
71
|
+
updateStateFor(state) {
|
72
|
+
this.checkboxTarget.checked = state;
|
73
|
+
|
74
|
+
if (state) {
|
75
|
+
this.labelTarget.classList.add('checked');
|
76
|
+
//Set the Rails hidden field that fakes an HTTP verb
|
77
|
+
//properly for current state action.
|
78
|
+
this.formTarget.querySelector('input[name=_method]').value = 'delete';
|
79
|
+
this.spanTarget.innerHTML = this.form.getAttribute('data-present');
|
80
|
+
} else {
|
81
|
+
this.labelTarget.classList.remove('checked');
|
82
|
+
this.formTarget.querySelector('input[name=_method]').value = 'put';
|
83
|
+
this.spanTarget.innerHTML = this.form.getAttribute('data-absent');
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
const BookmarkToggle = (e) => {
|
89
|
+
if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) {
|
90
|
+
const form = e.target.closest('form');
|
91
|
+
if (form) new CheckboxSubmit(form).clicked(e);
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
document.addEventListener('click', BookmarkToggle);
|
96
|
+
|
97
|
+
const ButtonFocus = (e) => {
|
98
|
+
// Button clicks should change focus. As of 10/3/19, Firefox for Mac and
|
99
|
+
// Safari both do not set focus to a button on button click.
|
100
|
+
// See https://zellwk.com/blog/inconsistent-button-behavior/ for background information
|
101
|
+
if (e.target.matches('[data-toggle="collapse"]') || e.target.matches('[data-bs-toggle="collapse"]')) {
|
102
|
+
e.target.focus();
|
103
|
+
}
|
104
|
+
};
|
105
|
+
|
106
|
+
document.addEventListener('click', ButtonFocus);
|
107
|
+
|
108
|
+
/*
|
109
|
+
The blacklight modal plugin can display some interactions inside a Bootstrap
|
110
|
+
modal window, including some multi-page interactions.
|
111
|
+
|
112
|
+
It supports unobtrusive Javascript, where a link or form that would have caused
|
113
|
+
a new page load is changed to display it's results inside a modal dialog,
|
114
|
+
by this plugin. The plugin assumes there is a Bootstrap modal div
|
115
|
+
on the page with id #blacklight-modal to use as the modal -- the standard Blacklight
|
116
|
+
layout provides this.
|
117
|
+
|
118
|
+
To make a link or form have their results display inside a modal, add
|
119
|
+
`data-blacklight-modal="trigger"` to the link or form. (Note, form itself not submit input)
|
120
|
+
With Rails link_to helper, you'd do that like:
|
121
|
+
|
122
|
+
link_to something, link, data: { blacklight_modal: "trigger" }
|
123
|
+
|
124
|
+
The results of the link href or form submit will be displayed inside
|
125
|
+
a modal -- they should include the proper HTML markup for a bootstrap modal's
|
126
|
+
contents. Also, you ordinarily won't want the Rails template with wrapping
|
127
|
+
navigational elements to be used. The Rails controller could suppress
|
128
|
+
the layout when a JS AJAX request is detected, OR the response
|
129
|
+
can include a `<div data-blacklight-modal="container">` -- only the contents
|
130
|
+
of the container will be placed inside the modal, the rest of the
|
131
|
+
page will be ignored.
|
132
|
+
|
133
|
+
Link or forms inside the modal will ordinarily cause page loads
|
134
|
+
when they are triggered. However, if you'd like their results
|
135
|
+
to stay within the modal, just add `data-blacklight-modal="preserve"`
|
136
|
+
to the link or form.
|
137
|
+
|
138
|
+
Here's an example of what might be returned, demonstrating most of the devices available:
|
139
|
+
|
140
|
+
<div data-blacklight-modal="container">
|
141
|
+
<div class="modal-header">
|
142
|
+
<button type="button" class="close" data-bl-dismiss="modal" aria-hidden="true">×</button>
|
143
|
+
<h3 class="modal-title">Request Placed</h3>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="modal-body">
|
147
|
+
<p>Some message</p>
|
148
|
+
<%= link_to "This result will still be within modal", some_link, data: { blacklight_modal: "preserve" } %>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
|
152
|
+
<div class="modal-footer">
|
153
|
+
<button type="button" class="btn btn-secondary" data-bl-dismiss="modal">Close</button>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
|
158
|
+
One additional feature. If the content returned from the AJAX form submission
|
159
|
+
can be a turbo-stream that defines some HTML fragementsand where on the page to put them:
|
160
|
+
https://turbo.hotwired.dev/handbook/streams
|
161
|
+
*/
|
162
|
+
|
163
|
+
const Modal = (() => {
|
164
|
+
const modal = {};
|
165
|
+
|
166
|
+
// a Bootstrap modal div that should be already on the page hidden
|
167
|
+
modal.modalSelector = '#blacklight-modal';
|
168
|
+
|
169
|
+
// Trigger selectors identify forms or hyperlinks that should open
|
170
|
+
// inside a modal dialog.
|
171
|
+
modal.triggerLinkSelector = 'a[data-blacklight-modal~=trigger]';
|
172
|
+
|
173
|
+
// preserve selectors identify forms or hyperlinks that, if activated already
|
174
|
+
// inside a modal dialog, should have destinations remain inside the modal -- but
|
175
|
+
// won't trigger a modal if not already in one.
|
176
|
+
//
|
177
|
+
// No need to repeat selectors from trigger selectors, those will already
|
178
|
+
// be preserved. MUST be manually prefixed with the modal selector,
|
179
|
+
// so they only apply to things inside a modal.
|
180
|
+
modal.preserveLinkSelector = modal.modalSelector + ' a[data-blacklight-modal~=preserve]';
|
181
|
+
|
182
|
+
modal.containerSelector = '[data-blacklight-modal~=container]';
|
183
|
+
|
184
|
+
// Called on fatal failure of ajax load, function returns content
|
185
|
+
// to show to user in modal. Right now called only for network errors.
|
186
|
+
modal.onFailure = function (error) {
|
187
|
+
console.error('Server error:', this.url, error);
|
188
|
+
|
189
|
+
const contents = `<div class="modal-header">
|
190
|
+
<div class="modal-title">There was a problem with your request.</div>
|
191
|
+
<button type="button" class="blacklight-modal-close btn-close close" data-bl-dismiss="modal" aria-label="Close">
|
192
|
+
<span aria-hidden="true" class="visually-hidden">×</span>
|
193
|
+
</button>
|
194
|
+
</div>
|
195
|
+
<div class="modal-body">
|
196
|
+
<p>Expected a successful response from the server, but got an error</p>
|
197
|
+
<pre>${this.url}\n${error}</pre>
|
198
|
+
</div>`;
|
199
|
+
|
200
|
+
document.querySelector(`${modal.modalSelector} .modal-content`).innerHTML = contents;
|
201
|
+
|
202
|
+
modal.show();
|
203
|
+
};
|
204
|
+
|
205
|
+
// Add the passed in contents to the modal and display it.
|
206
|
+
modal.receiveAjax = function (contents) {
|
207
|
+
const domparser = new DOMParser();
|
208
|
+
const dom = domparser.parseFromString(contents, "text/html");
|
209
|
+
// If there is a containerSelector on the document, use its children.
|
210
|
+
let elements = dom.querySelectorAll(`${modal.containerSelector} > *`);
|
211
|
+
if (elements.length == 0) {
|
212
|
+
// If the containerSelector wasn't found, use the whole document
|
213
|
+
elements = dom.body.childNodes;
|
214
|
+
}
|
215
|
+
|
216
|
+
document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(...elements);
|
217
|
+
|
218
|
+
modal.show();
|
219
|
+
};
|
220
|
+
|
221
|
+
|
222
|
+
modal.modalAjaxLinkClick = function(e) {
|
223
|
+
e.preventDefault();
|
224
|
+
const href = e.target.getAttribute('href');
|
225
|
+
fetch(href)
|
226
|
+
.then(response => {
|
227
|
+
if (!response.ok) {
|
228
|
+
throw new TypeError("Request failed");
|
229
|
+
}
|
230
|
+
return response.text();
|
231
|
+
})
|
232
|
+
.then(data => modal.receiveAjax(data))
|
233
|
+
.catch(error => modal.onFailure(error));
|
234
|
+
};
|
235
|
+
|
236
|
+
modal.setupModal = function() {
|
237
|
+
// Register both trigger and preserve selectors in ONE event handler, combining
|
238
|
+
// into one selector with a comma, so if something matches BOTH selectors, it
|
239
|
+
// still only gets the event handler called once.
|
240
|
+
document.addEventListener('click', (e) => {
|
241
|
+
if (e.target.closest(`${modal.triggerLinkSelector}, ${modal.preserveLinkSelector}`))
|
242
|
+
modal.modalAjaxLinkClick(e);
|
243
|
+
else if (e.target.closest('[data-bl-dismiss="modal"]'))
|
244
|
+
modal.hide();
|
245
|
+
});
|
246
|
+
};
|
247
|
+
|
248
|
+
modal.hide = function (el) {
|
249
|
+
const dom = document.querySelector(modal.modalSelector);
|
250
|
+
|
251
|
+
if (!dom.open) return
|
252
|
+
dom.close();
|
253
|
+
};
|
254
|
+
|
255
|
+
modal.show = function(el) {
|
256
|
+
const dom = document.querySelector(modal.modalSelector);
|
257
|
+
|
258
|
+
if (dom.open) return
|
259
|
+
dom.showModal();
|
260
|
+
};
|
261
|
+
|
262
|
+
modal.setupModal();
|
263
|
+
|
264
|
+
return modal;
|
265
|
+
})();
|
266
|
+
|
267
|
+
const SearchContext = (e) => {
|
268
|
+
if (e.target.matches('[data-context-href]')) {
|
269
|
+
SearchContext.handleSearchContextMethod.call(e.target, e);
|
270
|
+
}
|
271
|
+
};
|
272
|
+
|
273
|
+
SearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content;
|
274
|
+
SearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content;
|
275
|
+
|
276
|
+
// this is the Rails.handleMethod with a couple adjustments, described inline:
|
277
|
+
// first, we're attaching this directly to the event handler, so we can check for meta-keys
|
278
|
+
SearchContext.handleSearchContextMethod = function(event) {
|
279
|
+
const link = this;
|
280
|
+
|
281
|
+
// instead of using the normal href, we need to use the context href instead
|
282
|
+
let href = link.getAttribute('data-context-href');
|
283
|
+
let target = link.getAttribute('target');
|
284
|
+
let csrfToken = SearchContext.csrfToken();
|
285
|
+
let csrfParam = SearchContext.csrfParam();
|
286
|
+
let form = document.createElement('form');
|
287
|
+
form.method = 'post';
|
288
|
+
form.action = href;
|
289
|
+
|
290
|
+
|
291
|
+
let formContent = `<input name="_method" value="post" type="hidden" />
|
292
|
+
<input name="redirect" value="${link.getAttribute('href')}" type="hidden" />`;
|
293
|
+
|
294
|
+
// check for meta keys.. if set, we should open in a new tab
|
295
|
+
if(event.metaKey || event.ctrlKey) {
|
296
|
+
target = '_blank';
|
297
|
+
}
|
298
|
+
|
299
|
+
if (csrfParam !== undefined && csrfToken !== undefined) {
|
300
|
+
formContent += `<input name="${csrfParam}" value="${csrfToken}" type="hidden" />`;
|
301
|
+
}
|
302
|
+
|
303
|
+
// Must trigger submit by click on a button, else "submit" event handler won't work!
|
304
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
|
305
|
+
formContent += '<input type="submit" />';
|
306
|
+
|
307
|
+
if (target) { form.setAttribute('target', target); }
|
308
|
+
|
309
|
+
form.style.display = 'none';
|
310
|
+
form.innerHTML = formContent;
|
311
|
+
document.body.appendChild(form);
|
312
|
+
form.querySelector('[type="submit"]').click();
|
313
|
+
|
314
|
+
event.preventDefault();
|
315
|
+
};
|
316
|
+
|
317
|
+
document.addEventListener('click', SearchContext);
|
318
|
+
|
319
|
+
const Blacklight = function() {
|
320
|
+
const buffer = new Array;
|
321
|
+
return {
|
322
|
+
onLoad: function(func) {
|
323
|
+
buffer.push(func);
|
324
|
+
},
|
325
|
+
|
326
|
+
activate: function() {
|
327
|
+
for(let i = 0; i < buffer.length; i++) {
|
328
|
+
buffer[i].call();
|
329
|
+
}
|
330
|
+
},
|
331
|
+
|
332
|
+
listeners: function () {
|
333
|
+
const listeners = [];
|
334
|
+
if (typeof Turbo !== 'undefined') {
|
335
|
+
listeners.push('turbo:load', 'turbo:frame-load');
|
336
|
+
} else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
|
337
|
+
// Turbolinks 5
|
338
|
+
if (Turbolinks.BrowserAdapter) {
|
339
|
+
listeners.push('turbolinks:load');
|
340
|
+
} else {
|
341
|
+
// Turbolinks < 5
|
342
|
+
listeners.push('page:load', 'DOMContentLoaded');
|
343
|
+
}
|
344
|
+
} else {
|
345
|
+
listeners.push('DOMContentLoaded');
|
346
|
+
}
|
347
|
+
|
348
|
+
return listeners;
|
349
|
+
}
|
350
|
+
};
|
351
|
+
}();
|
352
|
+
|
353
|
+
// turbolinks triggers page:load events on page transition
|
354
|
+
// If app isn't using turbolinks, this event will never be triggered, no prob.
|
355
|
+
Blacklight.listeners().forEach(function(listener) {
|
356
|
+
document.addEventListener(listener, function() {
|
357
|
+
Blacklight.activate();
|
358
|
+
});
|
359
|
+
});
|
360
|
+
|
361
|
+
Blacklight.onLoad(function () {
|
362
|
+
const elem = document.querySelector('.no-js');
|
363
|
+
|
364
|
+
// The "no-js" class may already have been removed because this function is
|
365
|
+
// run on every turbo:load event, in that case, it won't find an element.
|
366
|
+
if (!elem) return;
|
367
|
+
|
368
|
+
elem.classList.remove('no-js');
|
369
|
+
elem.classList.add('js');
|
370
|
+
});
|
371
|
+
|
372
|
+
const index = {
|
373
|
+
BookmarkToggle,
|
374
|
+
ButtonFocus,
|
375
|
+
Modal,
|
376
|
+
SearchContext,
|
377
|
+
Core: Blacklight,
|
378
|
+
onLoad: Blacklight.onLoad
|
379
|
+
};
|
380
|
+
|
381
|
+
return index;
|
382
|
+
|
383
|
+
}));
|
384
|
+
//# sourceMappingURL=blacklight.js.map
|
@@ -0,0 +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 async clicked(evt) {\n this.spanTarget.innerHTML = this.form.getAttribute('data-inprogress')\n this.labelTarget.setAttribute('disabled', 'disabled');\n this.checkboxTarget.setAttribute('disabled', 'disabled');\n const response = await 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 })\n this.labelTarget.removeAttribute('disabled')\n this.checkboxTarget.removeAttribute('disabled')\n if (response.ok) {\n const json = await response.json()\n this.updateStateFor(!this.checked)\n document.querySelector('[data-role=bookmark-counter]').innerHTML = json.bookmarks.count\n } else {\n alert('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 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 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 if (elements.length == 0) {\n // If the containerSelector wasn't found, use the whole document\n elements = dom.body.childNodes\n }\n\n document.querySelector(`${modal.modalSelector} .modal-content`).replaceChildren(...elements)\n\n modal.show();\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 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;AACH;EACA,EAAE,MAAM,OAAO,C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,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,QAAEA,UAAI;EACN,EAAE,MAAM,EAAEA,UAAI,CAAC,MAAM;EACrB;;;;;;;;"}
|
data/blacklight.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
full text and/or metadata.)
|
18
18
|
s.license = "Apache 2.0"
|
19
19
|
|
20
|
-
s.files = `git ls-files -z`.split("\x0") + Dir.glob("app/assets/
|
20
|
+
s.files = `git ls-files -z`.split("\x0") + Dir.glob("app/assets/javascripts/blacklight/**/*")
|
21
21
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
22
22
|
s.bindir = 'exe'
|
23
23
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "blacklight-frontend",
|
3
|
-
"version": "8.0.0-beta.
|
3
|
+
"version": "8.0.0-beta.7",
|
4
4
|
"description": "[![Build Status](https://travis-ci.com/projectblacklight/blacklight.png?branch=main)](https://travis-ci.com/projectblacklight/blacklight) [![Gem Version](https://badge.fury.io/rb/blacklight.png)](http://badge.fury.io/rb/blacklight) [![Coverage Status](https://coveralls.io/repos/github/projectblacklight/blacklight/badge.svg?branch=main)](https://coveralls.io/github/projectblacklight/blacklight?branch=main)",
|
5
5
|
"main": "app/assets/javascripts/blacklight",
|
6
6
|
"module": "app/assets/javascripts/blacklight/blacklight.esm.js",
|
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.0.0.
|
4
|
+
version: 8.0.0.beta7
|
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: 2023-02-
|
20
|
+
date: 2023-02-23 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -378,6 +378,10 @@ files:
|
|
378
378
|
- app/assets/config/blacklight/manifest.js
|
379
379
|
- app/assets/images/blacklight/logo.png
|
380
380
|
- app/assets/images/favicon.ico
|
381
|
+
- app/assets/javascripts/blacklight/blacklight.esm.js
|
382
|
+
- app/assets/javascripts/blacklight/blacklight.esm.js.map
|
383
|
+
- app/assets/javascripts/blacklight/blacklight.js
|
384
|
+
- app/assets/javascripts/blacklight/blacklight.js.map
|
381
385
|
- app/assets/stylesheets/blacklight/_autocomplete.scss
|
382
386
|
- app/assets/stylesheets/blacklight/_balanced_list.scss
|
383
387
|
- app/assets/stylesheets/blacklight/_blacklight_base.scss
|