blacklight-frontend 7.10.0 → 7.21.2
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.
- package/README.md +2 -4
- package/app/assets/images/blacklight/list.svg +1 -0
- package/app/assets/images/blacklight/logo.png +0 -0
- package/app/assets/images/blacklight/search.svg +1 -0
- package/app/assets/images/favicon.ico +0 -0
- package/app/assets/javascripts/blacklight/blacklight.js +54 -30
- package/app/assets/stylesheets/blacklight/_balanced_list.scss +2 -2
- package/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +1 -1
- package/app/assets/stylesheets/blacklight/_constraints.scss +8 -5
- package/app/assets/stylesheets/blacklight/_controls.scss +10 -1
- package/app/assets/stylesheets/blacklight/_facets.scss +5 -3
- package/app/assets/stylesheets/blacklight/_header.scss +6 -6
- package/app/assets/stylesheets/blacklight/_icons.scss +5 -1
- package/app/assets/stylesheets/blacklight/_pagination.scss +1 -1
- package/app/assets/stylesheets/blacklight/_twitter_typeahead.scss +1 -0
- package/app/assets/stylesheets/blacklight/blacklight_defaults.scss +5 -1
- package/app/javascript/blacklight/button_focus.js +1 -0
- package/app/javascript/blacklight/core.js +16 -3
- package/app/javascript/blacklight/modal.js +12 -6
- package/app/javascript/blacklight/search_context.js +5 -3
- package/package.json +9 -3
- package/CONTRIBUTING.md +0 -50
- package/Gemfile.lock +0 -374
- package/VERSION +0 -1
- package/app/builders/blacklight/action_builder.rb +0 -57
- package/app/components/blacklight/constraint_layout_component.html.erb +0 -23
- package/app/components/blacklight/constraint_layout_component.rb +0 -16
- package/app/components/blacklight/document_component.html.erb +0 -29
- package/app/components/blacklight/document_component.rb +0 -121
- package/app/components/blacklight/document_metadata_component.html.erb +0 -5
- package/app/components/blacklight/document_metadata_component.rb +0 -21
- package/app/components/blacklight/facet_field_component.html.erb +0 -25
- package/app/components/blacklight/facet_field_component.rb +0 -11
- package/app/components/blacklight/facet_field_list_component.html.erb +0 -18
- package/app/components/blacklight/facet_field_list_component.rb +0 -22
- package/app/components/blacklight/facet_field_no_layout_component.rb +0 -13
- package/app/components/blacklight/facet_item_component.rb +0 -120
- package/app/components/blacklight/facet_item_pivot_component.rb +0 -84
- package/app/components/blacklight/metadata_field_component.html.erb +0 -8
- package/app/components/blacklight/metadata_field_component.rb +0 -31
- package/app/components/blacklight/metadata_field_layout_component.html.erb +0 -2
- package/app/components/blacklight/metadata_field_layout_component.rb +0 -16
- package/app/values/blacklight/types.rb +0 -31
- package/config/i18n-tasks.yml +0 -17
- package/docker-compose.yml +0 -35
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# Blacklight
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/projectblacklight/blacklight) [](http://badge.fury.io/rb/blacklight) [](https://codeclimate.com/github/projectblacklight/blacklight/test_coverage)
|
|
4
|
-
|
|
5
3
|
Blacklight is an open source Solr user interface discovery platform.
|
|
6
4
|
You can use Blacklight to enable searching and browsing of your collections.
|
|
7
5
|
Blacklight uses the [Apache Solr](http://lucene.apache.org/solr) search engine
|
|
@@ -37,11 +35,11 @@ rails generate blacklight:install
|
|
|
37
35
|
|
|
38
36
|
* Ruby 2.2+
|
|
39
37
|
* Bundler
|
|
40
|
-
* Rails 5.
|
|
38
|
+
* Rails 5.2+
|
|
41
39
|
|
|
42
40
|
## Contributing Code
|
|
43
41
|
|
|
44
|
-
Code contributions are always welcome, instructions for contributing can be found at [CONTRIBUTING.md](https://github.com/projectblacklight/blacklight/blob/
|
|
42
|
+
Code contributions are always welcome, instructions for contributing can be found at [CONTRIBUTING.md](https://github.com/projectblacklight/blacklight/blob/main/CONTRIBUTING.md).
|
|
45
43
|
|
|
46
44
|
## Configuring Apache Solr
|
|
47
45
|
You'll also want some information about how Blacklight expects [Apache Solr](http://lucene.apache.org/solr ) to run, which you can find in [README_SOLR](https://github.com/projectblacklight/blacklight/wiki/README_SOLR)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>
|
|
Binary file
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var Blacklight = function () {
|
|
2
4
|
var buffer = new Array();
|
|
3
5
|
return {
|
|
4
|
-
onLoad: function (func) {
|
|
6
|
+
onLoad: function onLoad(func) {
|
|
5
7
|
buffer.push(func);
|
|
6
8
|
},
|
|
7
|
-
activate: function () {
|
|
9
|
+
activate: function activate() {
|
|
8
10
|
for (var i = 0; i < buffer.length; i++) {
|
|
9
11
|
buffer[i].call();
|
|
10
12
|
}
|
|
11
13
|
},
|
|
12
|
-
listeners: function () {
|
|
14
|
+
listeners: function listeners() {
|
|
13
15
|
var listeners = [];
|
|
14
16
|
|
|
15
|
-
if (typeof
|
|
17
|
+
if (typeof Turbo !== 'undefined') {
|
|
18
|
+
listeners.push('turbo:load');
|
|
19
|
+
} else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
|
|
16
20
|
// Turbolinks 5
|
|
17
21
|
if (Turbolinks.BrowserAdapter) {
|
|
18
22
|
listeners.push('turbolinks:load');
|
|
@@ -36,7 +40,15 @@ Blacklight.listeners().forEach(function (listener) {
|
|
|
36
40
|
Blacklight.activate();
|
|
37
41
|
});
|
|
38
42
|
});
|
|
39
|
-
|
|
43
|
+
Blacklight.onLoad(function () {
|
|
44
|
+
var elem = document.querySelector('.no-js'); // The "no-js" class may already have been removed because this function is
|
|
45
|
+
// run on every turbo:load event, in that case, it won't find an element.
|
|
46
|
+
|
|
47
|
+
if (!elem) return;
|
|
48
|
+
elem.classList.remove('no-js');
|
|
49
|
+
elem.classList.add('js');
|
|
50
|
+
});
|
|
51
|
+
window.Blacklight = Blacklight;
|
|
40
52
|
/*global Bloodhound */
|
|
41
53
|
|
|
42
54
|
Blacklight.onLoad(function () {
|
|
@@ -82,7 +94,7 @@ Blacklight.onLoad(function () {
|
|
|
82
94
|
$(Blacklight.doBookmarkToggleBehavior.selector).blCheckboxSubmit({
|
|
83
95
|
// cssClass is added to elements added, plus used for id base
|
|
84
96
|
cssClass: 'toggle-bookmark',
|
|
85
|
-
success: function (checked, response) {
|
|
97
|
+
success: function success(checked, response) {
|
|
86
98
|
if (response.bookmarks) {
|
|
87
99
|
$('[data-role=bookmark-counter]').text(response.bookmarks.count);
|
|
88
100
|
}
|
|
@@ -99,8 +111,9 @@ Blacklight.onLoad(function () {
|
|
|
99
111
|
Blacklight.onLoad(function () {
|
|
100
112
|
// Button clicks should change focus. As of 10/3/19, Firefox for Mac and
|
|
101
113
|
// Safari both do not set focus to a button on button click.
|
|
102
|
-
|
|
103
|
-
|
|
114
|
+
// See https://zellwk.com/blog/inconsistent-button-behavior/ for background information
|
|
115
|
+
document.querySelectorAll('button.collapse-toggle').forEach(function (button) {
|
|
116
|
+
button.addEventListener('click', function () {
|
|
104
117
|
event.target.focus();
|
|
105
118
|
});
|
|
106
119
|
});
|
|
@@ -187,12 +200,12 @@ Blacklight.onLoad(function () {
|
|
|
187
200
|
dataType: 'json',
|
|
188
201
|
type: form.attr('method').toUpperCase(),
|
|
189
202
|
data: form.serialize(),
|
|
190
|
-
error: function () {
|
|
203
|
+
error: function error() {
|
|
191
204
|
label.removeAttr('disabled');
|
|
192
205
|
checkbox.removeAttr('disabled');
|
|
193
206
|
options.error.call();
|
|
194
207
|
},
|
|
195
|
-
success: function (data, status, xhr) {
|
|
208
|
+
success: function success(data, status, xhr) {
|
|
196
209
|
//if app isn't running at all, xhr annoyingly
|
|
197
210
|
//reports success with status 0.
|
|
198
211
|
if (xhr.status != 0) {
|
|
@@ -218,10 +231,10 @@ Blacklight.onLoad(function () {
|
|
|
218
231
|
$.fn.blCheckboxSubmit.defaults = {
|
|
219
232
|
//cssClass is added to elements added, plus used for id base
|
|
220
233
|
cssClass: 'blCheckboxSubmit',
|
|
221
|
-
error: function () {
|
|
234
|
+
error: function error() {
|
|
222
235
|
alert("Error");
|
|
223
236
|
},
|
|
224
|
-
success: function () {} //callback
|
|
237
|
+
success: function success() {} //callback
|
|
225
238
|
|
|
226
239
|
};
|
|
227
240
|
})(jQuery);
|
|
@@ -237,12 +250,12 @@ Blacklight.doResizeFacetLabelsAndCounts = function () {
|
|
|
237
250
|
}
|
|
238
251
|
|
|
239
252
|
document.querySelectorAll('.facet-values, .pivot-facet').forEach(function (elem) {
|
|
240
|
-
|
|
253
|
+
var nodes = elem.querySelectorAll('.facet-count'); // TODO: when we drop ie11 support, this can become the spread operator:
|
|
241
254
|
|
|
242
|
-
|
|
255
|
+
var longest = Array.from(nodes).sort(longer)[0];
|
|
243
256
|
|
|
244
257
|
if (longest && longest.textContent) {
|
|
245
|
-
|
|
258
|
+
var width = longest.textContent.length + 1 + 'ch';
|
|
246
259
|
elem.querySelector('.facet-count').style.width = width;
|
|
247
260
|
}
|
|
248
261
|
});
|
|
@@ -349,8 +362,9 @@ Blacklight.modal.modalCloseSelector = '[data-blacklight-modal~=close]'; // Calle
|
|
|
349
362
|
// to show to user in modal. Right now called only for extreme
|
|
350
363
|
// network errors.
|
|
351
364
|
|
|
352
|
-
Blacklight.modal.onFailure = function (
|
|
353
|
-
|
|
365
|
+
Blacklight.modal.onFailure = function (jqXHR, textStatus, errorThrown) {
|
|
366
|
+
console.error('Server error:', this.url, jqXHR.status, errorThrown);
|
|
367
|
+
var contents = '<div class="modal-header">' + '<div class="modal-title">There was a problem with your request.</div>' + '<button type="button" class="blacklight-modal-close btn-close close" data-dismiss="modal" aria-label="Close">' + ' <span aria-hidden="true">×</span>' + '</button></div>' + ' <div class="modal-body"><p>Expected a successful response from the server, but got an error</p>' + '<pre>' + this.type + ' ' + this.url + "\n" + jqXHR.status + ': ' + errorThrown + '</pre></div>';
|
|
354
368
|
$(Blacklight.modal.modalSelector).find('.modal-content').html(contents);
|
|
355
369
|
$(Blacklight.modal.modalSelector).modal('show');
|
|
356
370
|
};
|
|
@@ -358,7 +372,7 @@ Blacklight.modal.onFailure = function (data) {
|
|
|
358
372
|
Blacklight.modal.receiveAjax = function (contents) {
|
|
359
373
|
// does it have a data- selector for container?
|
|
360
374
|
// important we don't execute script tags, we shouldn't.
|
|
361
|
-
// code modelled off of JQuery ajax.load. https://github.com/jquery/jquery/blob/
|
|
375
|
+
// code modelled off of JQuery ajax.load. https://github.com/jquery/jquery/blob/main/src/ajax/load.js?source=c#L62
|
|
362
376
|
var container = $('<div>').append(jQuery.parseHTML(contents)).find(Blacklight.modal.containerSelector).first();
|
|
363
377
|
|
|
364
378
|
if (container.length !== 0) {
|
|
@@ -436,14 +450,26 @@ Blacklight.doSearchContextBehavior = function () {
|
|
|
436
450
|
return Blacklight.do_search_context_behavior();
|
|
437
451
|
}
|
|
438
452
|
|
|
439
|
-
|
|
453
|
+
var elements = document.querySelectorAll('a[data-context-href]'); // Equivalent to Array.from(), but supports ie11
|
|
440
454
|
|
|
441
|
-
|
|
455
|
+
var nodes = Array.prototype.slice.call(elements);
|
|
442
456
|
nodes.forEach(function (element) {
|
|
443
457
|
element.addEventListener('click', function (e) {
|
|
444
458
|
Blacklight.handleSearchContextMethod.call(e.currentTarget, e);
|
|
445
459
|
});
|
|
446
460
|
});
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
Blacklight.csrfToken = function () {
|
|
464
|
+
var _document$querySelect;
|
|
465
|
+
|
|
466
|
+
return (_document$querySelect = document.querySelector('meta[name=csrf-token]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
Blacklight.csrfParam = function () {
|
|
470
|
+
var _document$querySelect2;
|
|
471
|
+
|
|
472
|
+
return (_document$querySelect2 = document.querySelector('meta[name=csrf-param]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content;
|
|
447
473
|
}; // this is the Rails.handleMethod with a couple adjustments, described inline:
|
|
448
474
|
// first, we're attaching this directly to the event handler, so we can check for meta-keys
|
|
449
475
|
|
|
@@ -456,22 +482,21 @@ Blacklight.handleSearchContextMethod = function (event) {
|
|
|
456
482
|
|
|
457
483
|
var link = this; // instead of using the normal href, we need to use the context href instead
|
|
458
484
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
485
|
+
var href = link.getAttribute('data-context-href');
|
|
486
|
+
var target = link.getAttribute('target');
|
|
487
|
+
var csrfToken = Blacklight.csrfToken();
|
|
488
|
+
var csrfParam = Blacklight.csrfParam();
|
|
489
|
+
var form = document.createElement('form');
|
|
464
490
|
form.method = 'post';
|
|
465
491
|
form.action = href;
|
|
466
|
-
|
|
467
|
-
<input name="redirect" value="${link.getAttribute('href')}" type="hidden" />`; // check for meta keys.. if set, we should open in a new tab
|
|
492
|
+
var formContent = "<input name=\"_method\" value=\"post\" type=\"hidden\" />\n <input name=\"redirect\" value=\"".concat(link.getAttribute('href'), "\" type=\"hidden\" />"); // check for meta keys.. if set, we should open in a new tab
|
|
468
493
|
|
|
469
494
|
if (event.metaKey || event.ctrlKey) {
|
|
470
495
|
target = '_blank';
|
|
471
496
|
}
|
|
472
497
|
|
|
473
498
|
if (csrfParam !== undefined && csrfToken !== undefined) {
|
|
474
|
-
formContent +=
|
|
499
|
+
formContent += "<input name=\"".concat(csrfParam, "\" value=\"").concat(csrfToken, "\" type=\"hidden\" />");
|
|
475
500
|
} // Must trigger submit by click on a button, else "submit" event handler won't work!
|
|
476
501
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
|
|
477
502
|
|
|
@@ -488,7 +513,6 @@ Blacklight.handleSearchContextMethod = function (event) {
|
|
|
488
513
|
form.querySelector('[type="submit"]').click();
|
|
489
514
|
event.preventDefault();
|
|
490
515
|
event.stopPropagation();
|
|
491
|
-
event.stopImmediatePropagation();
|
|
492
516
|
};
|
|
493
517
|
|
|
494
518
|
Blacklight.onLoad(function () {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
dt {
|
|
3
3
|
font-weight: normal;
|
|
4
4
|
color: $field_name_color;
|
|
5
|
-
@media (max-width: breakpoint-
|
|
5
|
+
@media (max-width: breakpoint-min(md)) {
|
|
6
6
|
text-align: left;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
@media (min-width: breakpoint-
|
|
9
|
+
@media (min-width: breakpoint-min(md)) {
|
|
10
10
|
text-align: right;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
.constraints-container {
|
|
2
2
|
@extend .mb-2;
|
|
3
|
+
display: flex;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
6
|
.applied-filter {
|
|
7
|
+
@extend .mx-1;
|
|
8
|
+
|
|
6
9
|
.constraint-value {
|
|
7
10
|
cursor: default;
|
|
8
11
|
text-overflow: ellipsis;
|
|
9
12
|
overflow: hidden;
|
|
10
13
|
|
|
11
|
-
@media (max-width: breakpoint-
|
|
12
|
-
max-width: breakpoint-
|
|
14
|
+
@media (max-width: breakpoint-min(sm)) {
|
|
15
|
+
max-width: breakpoint-min(sm) * .5;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
@media (min-width: breakpoint-min(sm)) and (max-width: breakpoint-max(sm)) {
|
|
16
|
-
max-width: breakpoint-min(sm)
|
|
19
|
+
max-width: breakpoint-min(sm) * .5;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
@media (min-width: breakpoint-min(md)) and (max-width: breakpoint-max(md)) {
|
|
20
|
-
max-width: breakpoint-min(md)
|
|
23
|
+
max-width: breakpoint-min(md) * .5;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
@media (min-width: breakpoint-min(lg)) {
|
|
24
|
-
max-width: breakpoint-min(lg)
|
|
27
|
+
max-width: breakpoint-min(lg) * .5;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
&:hover, &:active {
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
.search-widgets {
|
|
2
|
+
display: flex;
|
|
3
|
+
|
|
4
|
+
> * {
|
|
5
|
+
@extend .mx-1;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
.sort-pagination,
|
|
2
10
|
.pagination-search-widgets {
|
|
3
11
|
border-bottom: $pagination-border-width solid $pagination-border-color;
|
|
@@ -34,7 +42,8 @@
|
|
|
34
42
|
display: inline-block;
|
|
35
43
|
|
|
36
44
|
.caption {
|
|
37
|
-
@extend .sr-only;
|
|
45
|
+
@extend .sr-only !optional;
|
|
46
|
+
@extend .visually-hidden !optional;
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
border-color: $navbar-light-toggler-border-color;
|
|
4
4
|
color: $navbar-light-active-color;
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
&:hover,
|
|
7
|
+
&:focus {
|
|
7
8
|
color: $navbar-light-active-color;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
@@ -82,7 +83,8 @@
|
|
|
82
83
|
.remove {
|
|
83
84
|
color: $text-muted;
|
|
84
85
|
font-weight: bold;
|
|
85
|
-
padding-left: $spacer
|
|
86
|
+
padding-left: $spacer * .5;
|
|
87
|
+
text-decoration: none;
|
|
86
88
|
|
|
87
89
|
&:hover {
|
|
88
90
|
color: theme-color("danger");
|
|
@@ -102,7 +104,7 @@
|
|
|
102
104
|
padding-right: 1em;
|
|
103
105
|
text-indent: -15px;
|
|
104
106
|
padding-left: 15px;
|
|
105
|
-
padding-bottom: $spacer
|
|
107
|
+
padding-bottom: $spacer * .5;
|
|
106
108
|
@include hyphens-auto;
|
|
107
109
|
}
|
|
108
110
|
|
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
background: transparent $logo-image no-repeat top left;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
@if $logo_image {
|
|
18
|
-
// deprecated
|
|
19
|
-
background: transparent image_url($logo_image) no-repeat top left;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
17
|
display: inline-block;
|
|
23
18
|
flex: 0 0 150px;
|
|
24
19
|
height: 50px;
|
|
@@ -49,7 +44,12 @@
|
|
|
49
44
|
.submit-search-text {
|
|
50
45
|
// hide 'search' label at very small screens
|
|
51
46
|
@media screen and (max-width: breakpoint-max(xs)) {
|
|
52
|
-
@
|
|
47
|
+
@if mixin-exists(sr-only) {
|
|
48
|
+
@include sr-only();
|
|
49
|
+
}
|
|
50
|
+
@if mixin-exists(visually-hidden) {
|
|
51
|
+
@include visually-hidden();
|
|
52
|
+
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/* Warning! If you want to change these, just copy them into your own theme css. But you want to remove the !default, which only will set them if not already set. */
|
|
2
2
|
|
|
3
3
|
$logo-image: image_url('blacklight/logo.png') !default;
|
|
4
|
-
$logo_image: false !default; // deprecated
|
|
5
4
|
|
|
6
5
|
/* label (field names) */
|
|
7
6
|
$field_name_color: $text-muted !default;
|
|
8
7
|
$zindex-typeahead: $zindex-dropdown;
|
|
8
|
+
|
|
9
|
+
// the default bootstrap font-family list includes "Segoe UI Emoji", which, on windows
|
|
10
|
+
// renders our remove icon as an emoji-sized x instead of what we see on all other platforms...
|
|
11
|
+
// so, for now (until we replace it with an SVG icon or something), we get to override bootstrap:
|
|
12
|
+
$remove-icon-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif !default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Blacklight.onLoad(function() {
|
|
2
2
|
// Button clicks should change focus. As of 10/3/19, Firefox for Mac and
|
|
3
3
|
// Safari both do not set focus to a button on button click.
|
|
4
|
+
// See https://zellwk.com/blog/inconsistent-button-behavior/ for background information
|
|
4
5
|
document.querySelectorAll('button.collapse-toggle').forEach((button) => {
|
|
5
6
|
button.addEventListener('click', () => {
|
|
6
7
|
event.target.focus();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Blacklight = function() {
|
|
1
|
+
const Blacklight = function() {
|
|
2
2
|
var buffer = new Array;
|
|
3
3
|
return {
|
|
4
4
|
onLoad: function(func) {
|
|
@@ -13,7 +13,9 @@ Blacklight = function() {
|
|
|
13
13
|
|
|
14
14
|
listeners: function () {
|
|
15
15
|
var listeners = [];
|
|
16
|
-
if (typeof
|
|
16
|
+
if (typeof Turbo !== 'undefined') {
|
|
17
|
+
listeners.push('turbo:load');
|
|
18
|
+
} else if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
|
|
17
19
|
// Turbolinks 5
|
|
18
20
|
if (Turbolinks.BrowserAdapter) {
|
|
19
21
|
listeners.push('turbolinks:load');
|
|
@@ -38,4 +40,15 @@ Blacklight.listeners().forEach(function(listener) {
|
|
|
38
40
|
})
|
|
39
41
|
})
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
Blacklight.onLoad(function () {
|
|
44
|
+
const elem = document.querySelector('.no-js');
|
|
45
|
+
|
|
46
|
+
// The "no-js" class may already have been removed because this function is
|
|
47
|
+
// run on every turbo:load event, in that case, it won't find an element.
|
|
48
|
+
if (!elem) return;
|
|
49
|
+
|
|
50
|
+
elem.classList.remove('no-js')
|
|
51
|
+
elem.classList.add('js')
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
window.Blacklight = Blacklight
|
|
@@ -101,12 +101,18 @@ Blacklight.modal.modalCloseSelector = '[data-blacklight-modal~=close]';
|
|
|
101
101
|
// Called on fatal failure of ajax load, function returns content
|
|
102
102
|
// to show to user in modal. Right now called only for extreme
|
|
103
103
|
// network errors.
|
|
104
|
-
Blacklight.modal.onFailure = function(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
Blacklight.modal.onFailure = function(jqXHR, textStatus, errorThrown) {
|
|
105
|
+
console.error('Server error:', this.url, jqXHR.status, errorThrown);
|
|
106
|
+
|
|
107
|
+
var contents = '<div class="modal-header">' +
|
|
108
|
+
'<div class="modal-title">There was a problem with your request.</div>' +
|
|
109
|
+
'<button type="button" class="blacklight-modal-close btn-close close" data-dismiss="modal" aria-label="Close">' +
|
|
108
110
|
' <span aria-hidden="true">×</span>' +
|
|
109
|
-
'</button>'
|
|
111
|
+
'</button></div>' +
|
|
112
|
+
' <div class="modal-body"><p>Expected a successful response from the server, but got an error</p>' +
|
|
113
|
+
'<pre>' +
|
|
114
|
+
this.type + ' ' + this.url + "\n" + jqXHR.status + ': ' + errorThrown +
|
|
115
|
+
'</pre></div>';
|
|
110
116
|
$(Blacklight.modal.modalSelector).find('.modal-content').html(contents);
|
|
111
117
|
$(Blacklight.modal.modalSelector).modal('show');
|
|
112
118
|
}
|
|
@@ -114,7 +120,7 @@ Blacklight.modal.onFailure = function(data) {
|
|
|
114
120
|
Blacklight.modal.receiveAjax = function (contents) {
|
|
115
121
|
// does it have a data- selector for container?
|
|
116
122
|
// important we don't execute script tags, we shouldn't.
|
|
117
|
-
// code modelled off of JQuery ajax.load. https://github.com/jquery/jquery/blob/
|
|
123
|
+
// code modelled off of JQuery ajax.load. https://github.com/jquery/jquery/blob/main/src/ajax/load.js?source=c#L62
|
|
118
124
|
var container = $('<div>').
|
|
119
125
|
append( jQuery.parseHTML(contents) ).find( Blacklight.modal.containerSelector ).first();
|
|
120
126
|
if (container.length !== 0) {
|
|
@@ -15,6 +15,9 @@ Blacklight.doSearchContextBehavior = function() {
|
|
|
15
15
|
})
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
Blacklight.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content
|
|
19
|
+
Blacklight.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content
|
|
20
|
+
|
|
18
21
|
// this is the Rails.handleMethod with a couple adjustments, described inline:
|
|
19
22
|
// first, we're attaching this directly to the event handler, so we can check for meta-keys
|
|
20
23
|
Blacklight.handleSearchContextMethod = function(event) {
|
|
@@ -27,8 +30,8 @@ Blacklight.handleSearchContextMethod = function(event) {
|
|
|
27
30
|
// instead of using the normal href, we need to use the context href instead
|
|
28
31
|
let href = link.getAttribute('data-context-href')
|
|
29
32
|
let target = link.getAttribute('target')
|
|
30
|
-
let csrfToken =
|
|
31
|
-
let csrfParam =
|
|
33
|
+
let csrfToken = Blacklight.csrfToken()
|
|
34
|
+
let csrfParam = Blacklight.csrfParam()
|
|
32
35
|
let form = document.createElement('form')
|
|
33
36
|
form.method = 'post'
|
|
34
37
|
form.action = href
|
|
@@ -59,7 +62,6 @@ Blacklight.handleSearchContextMethod = function(event) {
|
|
|
59
62
|
|
|
60
63
|
event.preventDefault()
|
|
61
64
|
event.stopPropagation()
|
|
62
|
-
event.stopImmediatePropagation()
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
Blacklight.onLoad(function() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blacklight-frontend",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "[](https://travis-ci.com/projectblacklight/blacklight) [](http://badge.fury.io/rb/blacklight) [](https://coveralls.io/github/projectblacklight/blacklight?branch=main)",
|
|
5
5
|
"main": "app/assets/javascripts/blacklight",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"js-compile-bundle": "shx cat app/javascript/blacklight/core.js app/javascript/blacklight/autocomplete.js app/javascript/blacklight/bookmark_toggle.js app/javascript/blacklight/button_focus.js app/javascript/blacklight/checkbox_submit.js app/javascript/blacklight/facet_load.js app/javascript/blacklight/modal.js app/javascript/blacklight/search_context.js | shx sed \"s/^(import|export).*//\" | babel --filename app/javascript/blacklight/blacklight.js > app/assets/javascripts/blacklight/blacklight.js"
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/projectblacklight/blacklight.git"
|
|
12
12
|
},
|
|
13
|
+
"files": [
|
|
14
|
+
"app/assets",
|
|
15
|
+
"app/javascript"
|
|
16
|
+
],
|
|
13
17
|
"author": "",
|
|
14
18
|
"license": "Apache-2.0",
|
|
15
19
|
"bugs": {
|
|
@@ -19,11 +23,13 @@
|
|
|
19
23
|
"devDependencies": {
|
|
20
24
|
"@babel/cli": "^7.2.3",
|
|
21
25
|
"@babel/core": "^7.2.3",
|
|
26
|
+
"@babel/preset-env": "^7.16.0",
|
|
22
27
|
"shx": "^0.3.2"
|
|
23
28
|
},
|
|
29
|
+
"browserslist": "> 0.25%, not dead",
|
|
24
30
|
"dependencies": {
|
|
25
31
|
"bloodhound-js": "^1.2.3",
|
|
26
|
-
"bootstrap": "
|
|
32
|
+
"bootstrap": ">=4.3.1 <6.0.0",
|
|
27
33
|
"jquery": "^3.5.1",
|
|
28
34
|
"typeahead.js": "^0.11.1"
|
|
29
35
|
}
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Contributing to Blacklight
|
|
2
|
-
|
|
3
|
-
Blacklight is a collaborative, open source project produced by developers from many diverse organizations. The Blacklight developers want to create an out-of-the-box framework that is easy to install and get started with, both as a service to the community and in the interests of our own institutions in creating a sustainable project and product.
|
|
4
|
-
|
|
5
|
-
Development is largely motivated by the needs of each developer’s organization, and we work on the shared project together so we can benefit from the community’s development efforts, experiences building discovery systems, and shared problem solving.
|
|
6
|
-
|
|
7
|
-
We always welcome contributions from the community, especially to add new features, address bugs or defects, and clarify existing code for future developers.
|
|
8
|
-
|
|
9
|
-
## Adding a ticket
|
|
10
|
-
Let us know you're interested in working on a feature by filing a ticket in our [issue tracker](https://github.com/projectblacklight/blacklight/issues).
|
|
11
|
-
|
|
12
|
-
## Making Your Changes
|
|
13
|
-
|
|
14
|
-
* Fork the project
|
|
15
|
-
* Start a feature/bugfix branch
|
|
16
|
-
* Commit and push until you are happy with your contribution
|
|
17
|
-
* Make sure to add tests for it. This is important so we don't break it in a future version unintentionally.
|
|
18
|
-
* After making your changes, be sure to run the [Blacklight tests](https://github.com/projectblacklight/blacklight/wiki/testing) to make sure everything works.
|
|
19
|
-
* Submit your change as a [Pull Request](https://help.github.com/en/articles/about-pull-requests).
|
|
20
|
-
|
|
21
|
-
## Pull Requests and Code Review
|
|
22
|
-
- Pull requests must be reviewed and approved by one non-author with write-permissions
|
|
23
|
-
- If additional code changes are made after approval, another approval (from the same or another qualified person) is required.
|
|
24
|
-
- A reviewer who has approved a PR but has not merged it should provide a comment (e.g. "This looks good, I'm just waiting for Travis to build", "This is a breaking change. I would like at least one more reviewer.")
|
|
25
|
-
- An approved PR may be merged by the reviewer, the author, or another committer
|
|
26
|
-
- Additional discussion and feedback by non-maintainers is heartily encouraged.
|
|
27
|
-
|
|
28
|
-
## Support
|
|
29
|
-
If you are interested in working on the Blacklight plugin, but want guidance or support, please send an email to our [Blacklight-development mailing list](http://groups.google.com/group/blacklight-development) and we'll be glad to help. The #blacklight channel on [code4lib Slack](https://code4lib.org/irc/) is another active forum for informal discussion and troubleshooting.
|
|
30
|
-
|
|
31
|
-
## Becoming a Committer
|
|
32
|
-
|
|
33
|
-
Anyone can contribute to Blacklight using pull requests, the issue tracker, and being active on the mailing list and IRC channels. Being a contributor means that you take an active interest in the project and contribute regularly in some way, ranging from asking sensible questions (which documents the project and provides feedback to developers) to providing new features as patches.
|
|
34
|
-
|
|
35
|
-
If you become a valuable contributor to the project you may be invited to become a committer. Blacklight code contributors become committers after being sponsored by one of the current active committers. The committers will take an Apache-style (+1/0/-1) vote to elevate them, and then a formal invitation will be extended to the contributor.
|
|
36
|
-
|
|
37
|
-
Committers should be:
|
|
38
|
-
|
|
39
|
-
- technically adept
|
|
40
|
-
- constructive, positive members of the Blacklight software community
|
|
41
|
-
- committed to producing useful, practical code for the community
|
|
42
|
-
|
|
43
|
-
You're expected to:
|
|
44
|
-
|
|
45
|
-
- contribute patches and new functionality to Blacklight and other shared development efforts (RSolr, Blacklight plugins, etc)
|
|
46
|
-
- actively participate in technical discussions on the email list, IRC, and github
|
|
47
|
-
- answer user support questions via the various channels
|
|
48
|
-
- review pull requests from fellow committers and the community
|
|
49
|
-
- test-drive new release candidates against your own institution's Blacklight applications
|
|
50
|
-
- participate in regular committer meetings, usually in the form of conference calls, to coordinate development & direction
|