blacklight 9.0.0.beta1 → 9.0.0.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/matrix.json +47 -0
- data/.github/workflows/build.yml +16 -0
- data/.github/workflows/lint.yml +25 -0
- data/.github/workflows/main.yml +22 -0
- data/.github/workflows/release_7_x_scheduled.yml +39 -0
- data/.github/workflows/release_8_x_scheduled.yml +39 -0
- data/.github/workflows/test.yml +53 -0
- data/.rubocop.yml +81 -3
- data/.rubocop_todo.yml +43 -67
- data/.solr_wrapper.yml +2 -0
- data/VERSION +1 -1
- data/app/assets/builds/blacklight.css +17 -18
- data/app/assets/javascripts/blacklight/blacklight.esm.js +43 -73
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +43 -73
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- data/app/assets/stylesheets/blacklight/_blacklight_base.scss +0 -1
- data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +4 -0
- data/app/assets/stylesheets/blacklight/_facets.scss +2 -2
- data/app/assets/stylesheets/blacklight/_header.scss +4 -0
- data/app/assets/stylesheets/blacklight/_modal.scss +9 -8
- data/app/assets/stylesheets/blacklight/_pagination.scss +1 -3
- data/app/assets/stylesheets/blacklight/_search_history.scss +0 -4
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +3 -0
- data/app/components/blacklight/advanced_search_form_component.rb +2 -2
- data/app/components/blacklight/constraint_layout_component.html.erb +1 -6
- data/app/components/blacklight/constraint_layout_component.rb +9 -0
- data/app/components/blacklight/constraints_component.rb +2 -2
- data/app/components/blacklight/document/action_component.rb +1 -3
- data/app/components/blacklight/document/bookmark_component.html.erb +2 -2
- data/app/components/blacklight/document/bookmark_component.rb +2 -2
- data/app/components/blacklight/document/more_like_this_component.rb +2 -2
- data/app/components/blacklight/document/page_header_component.rb +2 -2
- data/app/components/blacklight/document/thumbnail_component.html.erb +3 -7
- data/app/components/blacklight/document/thumbnail_component.rb +7 -6
- data/app/components/blacklight/document_component.html.erb +3 -3
- data/app/components/blacklight/document_component.rb +5 -5
- data/app/components/blacklight/document_title_component.rb +6 -10
- data/app/components/blacklight/facet_field_checkboxes_component.rb +4 -18
- data/app/components/blacklight/facet_field_component.rb +4 -15
- data/app/components/blacklight/facet_field_filter_component.rb +4 -19
- data/app/components/blacklight/facet_field_inclusive_constraint_component.rb +4 -23
- data/app/components/blacklight/facet_field_list_component.rb +4 -30
- data/app/components/blacklight/facet_field_no_layout_component.rb +4 -8
- data/app/components/blacklight/facet_field_pagination_component.html.erb +2 -2
- data/app/components/blacklight/facet_item_component.rb +4 -72
- data/app/components/blacklight/facet_item_pivot_component.rb +1 -1
- data/app/components/blacklight/facets/checkboxes_component.rb +26 -0
- data/app/components/blacklight/facets/count_component.rb +23 -0
- data/app/components/blacklight/{facet_field_component.html.erb → facets/field_component.html.erb} +1 -1
- data/app/components/blacklight/facets/field_component.rb +23 -0
- data/app/components/blacklight/facets/filters_component.html.erb +4 -0
- data/app/components/blacklight/facets/filters_component.rb +39 -0
- data/app/components/blacklight/{facet_field_inclusive_constraint_component.html.erb → facets/inclusive_constraint_component.html.erb} +1 -1
- data/app/components/blacklight/facets/inclusive_constraint_component.rb +31 -0
- data/app/components/blacklight/{facet_field_filter_component.html.erb → facets/index_navigation_component.html.erb} +1 -1
- data/app/components/blacklight/facets/index_navigation_component.rb +32 -0
- data/app/components/blacklight/facets/item_component.rb +73 -0
- data/app/components/blacklight/facets/list_component.html.erb +11 -0
- data/app/components/blacklight/facets/list_component.rb +40 -0
- data/app/components/blacklight/facets/no_layout_component.rb +16 -0
- data/app/components/blacklight/facets/selected_value_component.rb +29 -0
- data/app/components/blacklight/facets/suggest_component.html.erb +12 -0
- data/app/components/blacklight/facets/suggest_component.rb +22 -0
- data/app/components/blacklight/icons/remove_component.rb +2 -2
- data/app/components/blacklight/metadata_field_plain_text_layout_component.rb +2 -2
- data/app/components/blacklight/response/facet_group_component.html.erb +3 -3
- data/app/components/blacklight/response/facet_group_component.rb +9 -1
- data/app/components/blacklight/system/dropdown_component.html.erb +1 -1
- data/app/components/blacklight/system/dropdown_component.rb +1 -1
- data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
- data/app/components/blacklight/system/flash_message_component.rb +0 -9
- data/app/components/blacklight/system/modal_component.html.erb +1 -2
- data/app/components/blacklight/top_navbar_component.html.erb +1 -1
- data/app/controllers/concerns/blacklight/bookmarks.rb +3 -3
- data/app/controllers/concerns/blacklight/catalog.rb +16 -27
- data/app/controllers/concerns/blacklight/controller.rb +1 -1
- data/app/controllers/concerns/blacklight/facetable.rb +34 -0
- data/app/controllers/concerns/blacklight/search_context.rb +1 -1
- data/app/controllers/concerns/blacklight/searchable.rb +1 -1
- data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/document_helper_behavior.rb +3 -1
- data/app/helpers/blacklight/facets_helper_behavior.rb +9 -0
- data/app/helpers/blacklight/icon_helper_behavior.rb +2 -2
- data/app/javascript/blacklight-frontend/bookmark_toggle.js +7 -2
- data/app/javascript/blacklight-frontend/checkbox_submit.js +8 -1
- data/app/javascript/blacklight-frontend/debounce.js +1 -1
- data/app/javascript/blacklight-frontend/facet_suggest.js +23 -3
- data/app/javascript/blacklight-frontend/index.js +0 -2
- data/app/javascript/blacklight-frontend/modal.js +2 -6
- data/app/javascript/blacklight-frontend/search_context.js +3 -2
- data/app/models/facet_search_builder.rb +5 -0
- data/app/presenters/blacklight/facet_field_presenter.rb +1 -1
- data/app/presenters/blacklight/json_presenter.rb +8 -4
- data/app/presenters/blacklight/rendering/helper_method.rb +4 -4
- data/app/presenters/blacklight/rendering/join.rb +2 -2
- data/app/services/blacklight/facet_search_service.rb +44 -0
- data/app/services/blacklight/field_retriever.rb +1 -1
- data/app/services/blacklight/search_service.rb +6 -6
- data/app/values/blacklight/types.rb +2 -2
- data/app/views/catalog/_facet_pivot.html.erb +1 -1
- data/app/views/catalog/_home_text.html.erb +2 -2
- data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
- data/app/views/catalog/facet.html.erb +8 -10
- data/config/locales/blacklight.ar.yml +14 -13
- data/config/locales/blacklight.ca.yml +1 -0
- data/config/locales/blacklight.de.yml +13 -12
- data/config/locales/blacklight.en.yml +1 -0
- data/config/locales/blacklight.es.yml +13 -12
- data/config/locales/blacklight.fr.yml +14 -13
- data/config/locales/blacklight.hu.yml +15 -14
- data/config/locales/blacklight.it.yml +15 -14
- data/config/locales/blacklight.nl.yml +13 -12
- data/config/locales/blacklight.pt-BR.yml +15 -14
- data/config/locales/blacklight.sq.yml +14 -13
- data/config/locales/blacklight.zh.yml +11 -10
- data/lib/blacklight/abstract_repository.rb +2 -2
- data/lib/blacklight/abstract_search_builder.rb +154 -0
- data/lib/blacklight/configuration/context.rb +3 -3
- data/lib/blacklight/configuration/facet_field.rb +6 -6
- data/lib/blacklight/configuration/field.rb +4 -4
- data/lib/blacklight/configuration/fields.rb +0 -1
- data/lib/blacklight/configuration/search_field.rb +1 -1
- data/lib/blacklight/configuration/view_config.rb +2 -2
- data/lib/blacklight/configuration.rb +9 -4
- data/lib/blacklight/facet_search_builder.rb +18 -0
- data/lib/blacklight/nested_open_struct_with_hash_access.rb +1 -1
- data/lib/blacklight/open_struct_with_hash_access.rb +2 -2
- data/lib/blacklight/search_builder.rb +1 -159
- data/lib/blacklight/search_state/filter_field.rb +4 -4
- data/lib/blacklight/search_state/pivot_filter_field.rb +4 -4
- data/lib/blacklight/solr/abstract_filter_query_builder.rb +77 -0
- data/lib/blacklight/solr/default_filter_query_builder.rb +20 -0
- data/lib/blacklight/solr/facet_search_builder_behavior.rb +62 -0
- data/lib/blacklight/solr/repository.rb +12 -10
- data/lib/blacklight/solr/response/facets.rb +2 -2
- data/lib/blacklight/solr/response/params.rb +0 -4
- data/lib/blacklight/solr/response.rb +5 -1
- data/lib/blacklight/solr/search_builder_behavior.rb +17 -132
- data/lib/blacklight.rb +6 -4
- data/lib/generators/blacklight/assets/importmap_generator.rb +3 -5
- data/lib/generators/blacklight/assets_generator.rb +1 -1
- data/lib/generators/blacklight/search_builder_generator.rb +1 -1
- data/lib/generators/blacklight/templates/.solr_wrapper.yml +2 -0
- data/lib/generators/blacklight/templates/catalog_controller.rb +5 -3
- data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +0 -4
- data/package.json +3 -3
- data/spec/components/blacklight/advanced_search_form_component_spec.rb +18 -22
- data/spec/components/blacklight/constraint_layout_component_spec.rb +8 -8
- data/spec/components/blacklight/constraints_component_spec.rb +11 -11
- data/spec/components/blacklight/document/action_component_spec.rb +23 -15
- data/spec/components/blacklight/document/group_component_spec.rb +10 -15
- data/spec/components/blacklight/document/page_header_component_spec.rb +35 -28
- data/spec/components/blacklight/document/sidebar_component_spec.rb +5 -11
- data/spec/components/blacklight/document_component_spec.rb +98 -65
- data/spec/components/blacklight/facet_component_spec.rb +12 -8
- data/spec/components/blacklight/facet_item_pivot_component_spec.rb +12 -12
- data/spec/components/blacklight/{facet_field_checkboxes_component_spec.rb → facets/checkboxes_component_spec.rb} +13 -13
- data/spec/components/blacklight/facets/filters_component_spec.rb +36 -0
- data/spec/components/blacklight/facets/index_navigation_component_spec.rb +40 -0
- data/spec/components/blacklight/{facet_item_component_spec.rb → facets/item_component_spec.rb} +10 -10
- data/spec/components/blacklight/{facet_field_list_component_spec.rb → facets/list_component_spec.rb} +23 -23
- data/spec/components/blacklight/facets/suggest_component_spec.rb +68 -0
- data/spec/components/blacklight/header_component_spec.rb +2 -4
- data/spec/components/blacklight/hidden_search_state_component_spec.rb +7 -7
- data/spec/components/blacklight/metadata_field_component_spec.rb +17 -15
- data/spec/components/blacklight/response/facet_group_component_spec.rb +37 -0
- data/spec/components/blacklight/response/pagination_component_spec.rb +1 -1
- data/spec/components/blacklight/response/spellcheck_component_spec.rb +1 -1
- data/spec/components/blacklight/search_bar_component_spec.rb +4 -4
- data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +2 -2
- data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +3 -5
- data/spec/components/blacklight/skip_link_component_spec.rb +8 -11
- data/spec/components/blacklight/start_over_button_component_spec.rb +4 -4
- data/spec/components/blacklight/system/dropdown_component_spec.rb +26 -0
- data/spec/components/blacklight/system/flash_message_component_spec.rb +7 -11
- data/spec/controllers/catalog_controller_spec.rb +12 -20
- data/spec/features/facets_spec.rb +70 -7
- data/spec/features/modal_spec.rb +1 -1
- data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +10 -0
- data/spec/lib/blacklight/configuration/facet_field_spec.rb +2 -2
- data/spec/lib/blacklight/parameters_spec.rb +12 -1
- data/spec/lib/blacklight/search_state/filter_field_spec.rb +18 -0
- data/spec/models/blacklight/configuration_spec.rb +52 -28
- data/spec/models/blacklight/facet_search_builder_spec.rb +19 -0
- data/spec/models/blacklight/search_builder_spec.rb +1 -11
- data/spec/models/blacklight/solr/default_filter_query_builder_spec.rb +72 -0
- data/spec/models/blacklight/solr/document_spec.rb +0 -4
- data/spec/models/blacklight/solr/facet_search_builder_behavior_spec.rb +929 -0
- data/spec/models/blacklight/solr/repository_spec.rb +31 -29
- data/spec/models/blacklight/solr/response/facets_spec.rb +86 -40
- data/spec/models/blacklight/solr/response/group_response_spec.rb +8 -5
- data/spec/models/blacklight/solr/response/group_spec.rb +9 -5
- data/spec/models/blacklight/solr/response_spec.rb +96 -64
- data/spec/models/blacklight/solr/search_builder_behavior_spec.rb +2 -227
- data/spec/models/solr_document_spec.rb +5 -1
- data/spec/presenters/blacklight/json_presenter_spec.rb +17 -0
- data/spec/services/blacklight/search_service_spec.rb +6 -27
- data/spec/spec_helper.rb +0 -1
- data/spec/support/view_component_test_helpers.rb +0 -18
- data/spec/views/catalog/facet.html.erb_spec.rb +10 -3
- data/spec/views/catalog/index.atom.builder_spec.rb +6 -3
- data/spec/views/catalog/index.html.erb_spec.rb +3 -1
- metadata +57 -29
- data/.github/workflows/ruby.yml +0 -98
- data/app/assets/stylesheets/blacklight/_icons.scss +0 -4
- data/app/components/blacklight/facet_field_list_component.html.erb +0 -19
- data/app/components/blacklight/search/facet_suggest_input.html.erb +0 -9
- data/app/components/blacklight/search/facet_suggest_input.rb +0 -16
- data/app/javascript/blacklight-frontend/modalForm.js +0 -60
- data/app/views/catalog/_facet_index_navigation.html.erb +0 -1
- data/app/views/catalog/_facet_layout.html.erb +0 -8
- data/app/views/catalog/_facet_pagination.html.erb +0 -1
- data/spec/components/blacklight/document_metadata_component_spec.rb +0 -0
- data/spec/components/blacklight/search/facet_suggest_input_spec.rb +0 -33
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +0 -43
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +0 -41
- /data/app/components/blacklight/{facet_field_checkboxes_component.html.erb → facets/checkboxes_component.html.erb} +0 -0
@@ -36,10 +36,16 @@ export default class CheckboxSubmit {
|
|
36
36
|
}).then((json) => {
|
37
37
|
this.labelTarget.removeAttribute('disabled')
|
38
38
|
this.checkboxTarget.removeAttribute('disabled')
|
39
|
+
// For accessibility return keyboard focus
|
40
|
+
// back to the checkbox after form submission
|
41
|
+
this.checkboxTarget.focus()
|
39
42
|
this.updateStateFor(!this.checked)
|
40
43
|
this.bookmarksCounter().forEach(counter => {
|
41
44
|
counter.innerHTML = json.bookmarks.count;
|
42
45
|
});
|
46
|
+
|
47
|
+
var e = new CustomEvent('bookmark.blacklight', { detail: { checked: !this.checked } });
|
48
|
+
window.dispatchEvent(e)
|
43
49
|
}).catch((error) => {
|
44
50
|
this.handleError(error)
|
45
51
|
})
|
@@ -74,7 +80,8 @@ export default class CheckboxSubmit {
|
|
74
80
|
}
|
75
81
|
|
76
82
|
updateStateFor(state) {
|
77
|
-
this.checkboxTarget.checked
|
83
|
+
if (state) { this.checkboxTarget.setAttribute('checked', state) }
|
84
|
+
else { this.checkboxTarget.removeAttribute('checked') }
|
78
85
|
|
79
86
|
if (state) {
|
80
87
|
this.labelTarget.classList.add('checked')
|
@@ -3,7 +3,7 @@
|
|
3
3
|
// const basicFunction = (entry) => console.log(entry)
|
4
4
|
// const debounced = debounce(basicFunction("I should only be called once"));
|
5
5
|
//
|
6
|
-
// debounced // does NOT print to the screen
|
6
|
+
// debounced // does NOT print to the screen because it is invoked again less than 200 milliseconds later
|
7
7
|
// debounced // does print to the screen
|
8
8
|
// ```
|
9
9
|
export default function debounce(func, timeout = 200) {
|
@@ -4,20 +4,40 @@ const FacetSuggest = async (e) => {
|
|
4
4
|
if (e.target.matches('.facet-suggest')) {
|
5
5
|
const queryFragment = e.target.value?.trim();
|
6
6
|
const facetField = e.target.dataset.facetField;
|
7
|
+
const facetArea = document.querySelector('.facet-extended-list');
|
8
|
+
const prevNextLinks = document.querySelectorAll('.prev_next_links');
|
9
|
+
|
7
10
|
if (!facetField) { return; }
|
8
11
|
|
9
|
-
|
12
|
+
// Get the search params from the current query so the facet suggestions
|
13
|
+
// can retain that context.
|
14
|
+
const facetSearchContext = e.target.dataset.facetSearchContext;
|
15
|
+
const url = new URL(facetSearchContext, window.location.origin);
|
16
|
+
|
17
|
+
// Drop facet.page so a filtered suggestion list will always start on page 1
|
18
|
+
url.searchParams.delete('facet.page');
|
19
|
+
const facetSearchParams = url.searchParams.toString();
|
20
|
+
|
21
|
+
const urlToFetch = `/catalog/facet_suggest/${facetField}/${queryFragment}?${facetSearchParams}`;
|
22
|
+
|
10
23
|
const response = await fetch(urlToFetch);
|
11
24
|
if (response.ok) {
|
12
25
|
const blob = await response.blob()
|
13
26
|
const text = await blob.text()
|
14
27
|
|
15
|
-
const facetArea = document.querySelector('.facet-extended-list');
|
16
|
-
|
17
28
|
if (text && facetArea) {
|
18
29
|
facetArea.innerHTML = text
|
19
30
|
}
|
20
31
|
}
|
32
|
+
|
33
|
+
// Hide the prev/next links when a user enters text in the facet
|
34
|
+
// suggestion input. They don't work with a filtered list.
|
35
|
+
prevNextLinks.forEach(element => {
|
36
|
+
element.classList.toggle('invisible', !!queryFragment);
|
37
|
+
});
|
38
|
+
|
39
|
+
// Add a class to distinguish suggested facet values vs. regular.
|
40
|
+
facetArea.classList.toggle('facet-suggestions', !!queryFragment);
|
21
41
|
}
|
22
42
|
};
|
23
43
|
|
@@ -2,7 +2,6 @@ import BookmarkToggle from 'blacklight-frontend/bookmark_toggle'
|
|
2
2
|
import ButtonFocus from 'blacklight-frontend/button_focus'
|
3
3
|
import FacetSuggest from 'blacklight-frontend/facet_suggest'
|
4
4
|
import Modal from 'blacklight-frontend/modal'
|
5
|
-
import ModalForm from 'blacklight-frontend/modalForm'
|
6
5
|
import SearchContext from 'blacklight-frontend/search_context'
|
7
6
|
import Core from 'blacklight-frontend/core'
|
8
7
|
|
@@ -11,7 +10,6 @@ export default {
|
|
11
10
|
ButtonFocus,
|
12
11
|
FacetSuggest,
|
13
12
|
Modal,
|
14
|
-
ModalForm,
|
15
13
|
SearchContext,
|
16
14
|
Core,
|
17
15
|
onLoad: Core.onLoad
|
@@ -56,9 +56,6 @@
|
|
56
56
|
const Modal = (() => {
|
57
57
|
const modal = {}
|
58
58
|
|
59
|
-
// bootstrap class that will stop body scrolling when modal is open
|
60
|
-
const bootstrapBodyClassOpen = "modal-open";
|
61
|
-
|
62
59
|
// a Bootstrap modal div that should be already on the page hidden
|
63
60
|
modal.modalSelector = '#blacklight-modal';
|
64
61
|
|
@@ -84,8 +81,7 @@ const Modal = (() => {
|
|
84
81
|
|
85
82
|
const contents = `<div class="modal-header">
|
86
83
|
<div class="modal-title">There was a problem with your request.</div>
|
87
|
-
<button type="button" class="blacklight-modal-close btn-close
|
88
|
-
<span aria-hidden="true" class="visually-hidden">×</span>
|
84
|
+
<button type="button" class="blacklight-modal-close btn-close" data-bl-dismiss="modal" aria-label="Close">
|
89
85
|
</button>
|
90
86
|
</div>
|
91
87
|
<div class="modal-body">
|
@@ -137,7 +133,7 @@ const Modal = (() => {
|
|
137
133
|
|
138
134
|
modal.modalAjaxLinkClick = function(e) {
|
139
135
|
e.preventDefault();
|
140
|
-
const href = e.target.getAttribute('href')
|
136
|
+
const href = e.target.closest('a').getAttribute('href')
|
141
137
|
fetch(href)
|
142
138
|
.then(response => {
|
143
139
|
if (!response.ok) {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
const SearchContext = (e) => {
|
2
|
-
|
3
|
-
|
2
|
+
const contextLink = e.target.closest('[data-context-href]')
|
3
|
+
if (contextLink) {
|
4
|
+
SearchContext.handleSearchContextMethod.call(contextLink, e)
|
4
5
|
}
|
5
6
|
}
|
6
7
|
|
@@ -4,7 +4,7 @@ module Blacklight
|
|
4
4
|
class FacetFieldPresenter
|
5
5
|
attr_reader :facet_field, :display_facet, :view_context, :search_state
|
6
6
|
|
7
|
-
delegate :key, to: :facet_field
|
7
|
+
delegate :key, :suggest, to: :facet_field
|
8
8
|
delegate :field_name, to: :display_facet
|
9
9
|
|
10
10
|
def initialize(facet_field, display_facet, view_context, search_state = view_context.search_state)
|
@@ -11,11 +11,9 @@ module Blacklight
|
|
11
11
|
|
12
12
|
attr_reader :blacklight_config
|
13
13
|
|
14
|
-
delegate :
|
14
|
+
delegate :facet_fields, :facet_configuration_for_field, to: :blacklight_config
|
15
15
|
|
16
|
-
|
17
|
-
@response.documents
|
18
|
-
end
|
16
|
+
delegate :documents, to: :@response
|
19
17
|
|
20
18
|
# @return [Array<Blacklight::Solr::Response::Facets::FacetField>]
|
21
19
|
def search_facets
|
@@ -25,6 +23,12 @@ module Blacklight
|
|
25
23
|
.select { |display_facet| display_facet.items.present? }
|
26
24
|
end
|
27
25
|
|
26
|
+
# NOTE: we don't use the facet_field_names method in Blacklight::Configuration because that
|
27
|
+
# only returns the field names of the group where the name is nil.
|
28
|
+
def facet_field_names
|
29
|
+
facet_fields.values.map(&:field)
|
30
|
+
end
|
31
|
+
|
28
32
|
# extract the pagination info from the response object
|
29
33
|
def pagination_info
|
30
34
|
h = {}
|
@@ -15,10 +15,10 @@ module Blacklight
|
|
15
15
|
|
16
16
|
def render_helper
|
17
17
|
context.send(config.helper_method,
|
18
|
-
**options
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
**options, document: document,
|
19
|
+
field: config.field,
|
20
|
+
config: config,
|
21
|
+
value: values)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# FacetSearchService returns a facet list from the repository. This is for drawing the "more facets" modal
|
4
|
+
module Blacklight
|
5
|
+
class FacetSearchService
|
6
|
+
def initialize(config:, search_state:, search_builder_class: config.facet_search_builder_class, **context)
|
7
|
+
@blacklight_config = config
|
8
|
+
@search_state = search_state
|
9
|
+
@user_params = @search_state.params
|
10
|
+
@search_builder_class = search_builder_class
|
11
|
+
@context = context
|
12
|
+
end
|
13
|
+
|
14
|
+
# The blacklight_config + controller are accessed by the search_builder
|
15
|
+
attr_reader :blacklight_config, :context
|
16
|
+
|
17
|
+
def search_builder
|
18
|
+
search_builder_class.new(self)
|
19
|
+
end
|
20
|
+
|
21
|
+
def search_state_class
|
22
|
+
@search_state.class
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Get the solr response when retrieving only a single facet field
|
27
|
+
# @return [Blacklight::Solr::Response] the solr response
|
28
|
+
def facet_field_response(facet_field, extra_controller_params = {})
|
29
|
+
query = search_builder.with(search_state).facet(facet_field)
|
30
|
+
repository.search(params: query.merge(extra_controller_params))
|
31
|
+
end
|
32
|
+
|
33
|
+
def facet_suggest_response(facet_field, facet_suggestion_query, extra_controller_params = {})
|
34
|
+
query = search_builder.with(search_state).facet(facet_field).facet_suggestion_query(facet_suggestion_query)
|
35
|
+
repository.search(params: query.merge(extra_controller_params))
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
attr_reader :search_builder_class, :search_state
|
41
|
+
|
42
|
+
delegate :repository, to: :blacklight_config
|
43
|
+
end
|
44
|
+
end
|
@@ -41,7 +41,7 @@ module Blacklight
|
|
41
41
|
|
42
42
|
def retrieve_simple
|
43
43
|
# regular document field
|
44
|
-
if field_config.default
|
44
|
+
if field_config.default.is_a?(Proc)
|
45
45
|
document.fetch(field_config.field, &field_config.default)
|
46
46
|
else
|
47
47
|
document.fetch(field_config.field, field_config.default)
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# SearchService returns search results from the repository
|
4
4
|
module Blacklight
|
5
5
|
class SearchService
|
6
|
-
def initialize(config:, search_state
|
6
|
+
def initialize(config:, search_state:, search_builder_class: config.search_builder_class, **context)
|
7
7
|
@blacklight_config = config
|
8
|
-
@search_state = search_state
|
8
|
+
@search_state = search_state
|
9
9
|
@user_params = @search_state.params
|
10
10
|
@search_builder_class = search_builder_class
|
11
11
|
@context = context
|
@@ -31,7 +31,7 @@ module Blacklight
|
|
31
31
|
builder.rows = search_state.per_page
|
32
32
|
|
33
33
|
builder = yield(builder) if block_given?
|
34
|
-
response = repository.search(builder)
|
34
|
+
response = repository.search(params: builder)
|
35
35
|
|
36
36
|
if response.grouped? && grouped_key_for_results
|
37
37
|
response.group(grouped_key_for_results)
|
@@ -59,12 +59,12 @@ module Blacklight
|
|
59
59
|
# @return [Blacklight::Solr::Response] the solr response
|
60
60
|
def facet_field_response(facet_field, extra_controller_params = {})
|
61
61
|
query = search_builder.with(search_state).facet(facet_field)
|
62
|
-
repository.search(query.merge(extra_controller_params))
|
62
|
+
repository.search(params: query.merge(extra_controller_params))
|
63
63
|
end
|
64
64
|
|
65
65
|
def facet_suggest_response(facet_field, facet_suggestion_query, extra_controller_params = {})
|
66
66
|
query = search_builder.with(search_state).facet(facet_field).facet_suggestion_query(facet_suggestion_query)
|
67
|
-
repository.search(query.merge(extra_controller_params))
|
67
|
+
repository.search(params: query.merge(extra_controller_params))
|
68
68
|
end
|
69
69
|
|
70
70
|
# Get the previous and next document from a search result
|
@@ -73,7 +73,7 @@ module Blacklight
|
|
73
73
|
p = previous_and_next_document_params(index)
|
74
74
|
new_state = request_params.is_a?(Blacklight::SearchState) ? request_params : Blacklight::SearchState.new(request_params, blacklight_config)
|
75
75
|
query = search_builder.with(new_state).start(p.delete(:start)).rows(p.delete(:rows)).merge(extra_controller_params).merge(p)
|
76
|
-
response = repository.search(query)
|
76
|
+
response = repository.search(params: query)
|
77
77
|
document_list = response.documents
|
78
78
|
|
79
79
|
# only get the previous doc if there is one
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<div class="
|
2
|
-
<h1 class="
|
1
|
+
<div class="text-center p-5 mb-4 bg-light rounded-3">
|
2
|
+
<h1 class="fw-bold"><%= t('blacklight.welcome') %></h1>
|
3
3
|
|
4
4
|
<p class="lead">Blacklight is a multi-institutional open-source collaboration building a better discovery platform framework.</p>
|
5
5
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="sortAndPerPage" class="sort-pagination pb-3 d-md-flex justify-content-between" role="navigation" aria-label="<%= t('blacklight.search.per_page.aria_label')%>">
|
1
|
+
<div id="sortAndPerPage" class="sort-pagination pb-3 mb-3 d-md-flex justify-content-between" role="navigation" aria-label="<%= t('blacklight.search.per_page.aria_label')%>">
|
2
2
|
<%= render partial: "paginate_compact", object: @response if show_pagination? %>
|
3
3
|
<%= render_results_collection_tools wrapping_class: "search-widgets" %>
|
4
4
|
</div>
|
@@ -1,14 +1,12 @@
|
|
1
1
|
<%= render Blacklight::System::ModalComponent.new do |component| %>
|
2
|
-
<% component.with_prefix do %>
|
3
|
-
<div class="facet-pagination top d-flex w-100 justify-content-between">
|
4
|
-
<%= render :partial=>'facet_pagination' %>
|
5
|
-
</div>
|
6
|
-
<% end %>
|
7
|
-
|
8
2
|
<% component.with_title { facet_field_label(@facet.key) } %>
|
9
|
-
|
3
|
+
<% view_config = blacklight_config.view_config(document_index_view_type) %>
|
10
4
|
|
11
|
-
<%= render
|
5
|
+
<%= render view_config.facet_filters_component.new(presenter: @presenter) %>
|
6
|
+
|
7
|
+
<div class="facet-pagination top d-flex flex-wrap w-100 justify-content-between border-bottom pb-3 mb-3">
|
8
|
+
<%= render view_config.facet_pagination_component.new(facet_field: @presenter) %>
|
9
|
+
</div>
|
12
10
|
|
13
11
|
<div class="facet-extended-list">
|
14
12
|
<%= render Blacklight::FacetComponent.new(display_facet: @display_facet,
|
@@ -17,8 +15,8 @@
|
|
17
15
|
</div>
|
18
16
|
|
19
17
|
<% component.with_footer do %>
|
20
|
-
<div class="facet-pagination bottom flex-
|
21
|
-
<%= render :
|
18
|
+
<div class="facet-pagination bottom d-flex flex-wrap w-100 justify-content-between">
|
19
|
+
<%= render view_config.facet_pagination_component.new(facet_field: @presenter) %>
|
22
20
|
</div>
|
23
21
|
<% end %>
|
24
22
|
<% end %>
|
@@ -36,29 +36,29 @@ ar:
|
|
36
36
|
apa: الجمعية الأمريكية لعلم النفس APA
|
37
37
|
chicago: شيكاغو
|
38
38
|
mla: جمعية اللغة الحديثة MLA
|
39
|
-
did_you_mean:
|
39
|
+
did_you_mean: "هل كنت تقصد كتابة: %{options}؟"
|
40
40
|
email:
|
41
41
|
errors:
|
42
42
|
to:
|
43
43
|
blank: يجب إدخال مُستلم من أجل إرسال هذه الرسالة
|
44
44
|
invalid: يجب إدخال عنوان بريد إلكتروني صحيح
|
45
45
|
form:
|
46
|
-
message:
|
46
|
+
message: "الرسالة:"
|
47
47
|
submit: إرسال
|
48
48
|
title: إرسله عبرالبريد الإلكتروني
|
49
|
-
to:
|
49
|
+
to: "بريد إلكتروني:"
|
50
50
|
success: تم إرسال البريد الإلكتروني
|
51
51
|
text:
|
52
52
|
default_title: لا يوجد
|
53
|
-
message:
|
53
|
+
message: "الرسالة: %{message}"
|
54
54
|
subject:
|
55
55
|
few: سجلات المادة
|
56
56
|
many: سجلات المادة
|
57
|
-
one:
|
57
|
+
one: "سجل المادة: %{title}"
|
58
58
|
other: سجلات المادة
|
59
59
|
two: سجلان للمادة
|
60
60
|
zero: لا يوجد سجل للمادة
|
61
|
-
url:
|
61
|
+
url: "الرابط: %{url}"
|
62
62
|
entry_name:
|
63
63
|
default: إدخال
|
64
64
|
grouped:
|
@@ -112,15 +112,15 @@ ar:
|
|
112
112
|
count: ترتيب رقمي
|
113
113
|
index: ترتيب أبجدي
|
114
114
|
suggest:
|
115
|
-
label:
|
116
|
-
placeholder:
|
115
|
+
label: الفلتر %{field_label}
|
116
|
+
placeholder: فلتر...
|
117
117
|
title: تحديد نطاق البحث
|
118
118
|
filters:
|
119
119
|
label: "%{label}:"
|
120
120
|
remove:
|
121
|
-
label_value:
|
121
|
+
label_value: "إزالة القيد %{label}: %{value}"
|
122
122
|
value: إزالة القيد %{value}
|
123
|
-
title:
|
123
|
+
title: "لقد بحثت عن:"
|
124
124
|
form:
|
125
125
|
search:
|
126
126
|
label: ابحث عن
|
@@ -139,6 +139,7 @@ ar:
|
|
139
139
|
constraint: "%{label}: %{value}"
|
140
140
|
many_constraint_values: تم تحديد %{values}
|
141
141
|
title: "%{constraints} - %{application_name} نتائج البحث"
|
142
|
+
joiner: " / "
|
142
143
|
pagination:
|
143
144
|
title: تصفح النتائج
|
144
145
|
pagination_info:
|
@@ -171,7 +172,7 @@ ar:
|
|
171
172
|
start_over: البدء من جديد
|
172
173
|
view:
|
173
174
|
list: قائمة
|
174
|
-
view_title:
|
175
|
+
view_title: "عرض النتائج ك: "
|
175
176
|
zero_results:
|
176
177
|
modify_search: حاول تعديل معايير البحث
|
177
178
|
search_everything: حاول البحث عن كل شيء
|
@@ -208,10 +209,10 @@ ar:
|
|
208
209
|
carrier_prompt: يرجى تحديد شركة الاتصالات
|
209
210
|
submit: إرسال
|
210
211
|
title: إرسله كرسالة نصية قصيرة
|
211
|
-
to:
|
212
|
+
to: "رقم الهاتف:"
|
212
213
|
success: تم الإرسال كرسالة نصية قصيرة
|
213
214
|
text:
|
214
|
-
url:
|
215
|
+
url: "الرابط: %{url}"
|
215
216
|
tools:
|
216
217
|
citation: استشهاد مرجعي
|
217
218
|
clear: مسح
|
@@ -134,6 +134,7 @@ ca:
|
|
134
134
|
title: "%{constraints} - %{application_name} Resultats de la cerca"
|
135
135
|
constraint: "%{label}: %{value}"
|
136
136
|
many_constraint_values: "%{values} seleccionat"
|
137
|
+
joiner: " / "
|
137
138
|
header: "Cerca"
|
138
139
|
search_constraints_header: "Filtres de la cerca"
|
139
140
|
search_results: "Resultats de la cerca"
|
@@ -32,25 +32,25 @@ de:
|
|
32
32
|
apa: APA
|
33
33
|
chicago: Chicago
|
34
34
|
mla: MLA
|
35
|
-
did_you_mean:
|
35
|
+
did_you_mean: "Meinten Sie: %{options}?"
|
36
36
|
email:
|
37
37
|
errors:
|
38
38
|
to:
|
39
39
|
blank: Sie müssen einen Empfänger eingeben, um diese Mitteilung zu schicken
|
40
40
|
invalid: Sie müssen eine gültige E-Mail-Addresse eingeben
|
41
41
|
form:
|
42
|
-
message:
|
42
|
+
message: "Nachricht:"
|
43
43
|
submit: Senden
|
44
44
|
title: E-Mail
|
45
|
-
to:
|
45
|
+
to: "E-Mail-Adresse:"
|
46
46
|
success: E-Mail verschickt
|
47
47
|
text:
|
48
48
|
default_title: N/A
|
49
|
-
message:
|
49
|
+
message: "Mitteilung: %{message}"
|
50
50
|
subject:
|
51
|
-
one:
|
51
|
+
one: "Artikeldatensatz: %{title}"
|
52
52
|
other: Artikeldatensätze
|
53
|
-
url:
|
53
|
+
url: "URL: %{url}"
|
54
54
|
entry_name:
|
55
55
|
default:
|
56
56
|
one: Eintrag
|
@@ -92,7 +92,7 @@ de:
|
|
92
92
|
close: Facetten ausblenden
|
93
93
|
open: Facetten zeigen
|
94
94
|
missing:
|
95
|
-
|
95
|
+
- fehlt
|
96
96
|
more_html: mehr <span class="visually-hidden">%{field_name}</span> »
|
97
97
|
pivot:
|
98
98
|
hide: Schließen
|
@@ -109,9 +109,9 @@ de:
|
|
109
109
|
filters:
|
110
110
|
label: "%{label}:"
|
111
111
|
remove:
|
112
|
-
label_value:
|
112
|
+
label_value: "Filter %{label}: %{value} entfernen"
|
113
113
|
value: Filter %{value} entfernen
|
114
|
-
title:
|
114
|
+
title: "Sie suchten nach:"
|
115
115
|
form:
|
116
116
|
search:
|
117
117
|
label: suchen nach
|
@@ -130,6 +130,7 @@ de:
|
|
130
130
|
constraint: "%{label}: %{value}"
|
131
131
|
many_constraint_values: "%{values} ausgewählt"
|
132
132
|
title: "%{constraints} - %{application_name} Suchergebnisse"
|
133
|
+
joiner: " / "
|
133
134
|
pagination:
|
134
135
|
title: Ergebnisse Navigation
|
135
136
|
pagination_info:
|
@@ -158,7 +159,7 @@ de:
|
|
158
159
|
start_over: Neu anfangen
|
159
160
|
view:
|
160
161
|
list: Liste
|
161
|
-
view_title:
|
162
|
+
view_title: "Ergebnisse ansehen als: "
|
162
163
|
zero_results:
|
163
164
|
modify_search: Ändern Sie Ihre Suche
|
164
165
|
search_everything: Suchen Sie nach allem
|
@@ -195,10 +196,10 @@ de:
|
|
195
196
|
carrier_prompt: Bitte wählen Sie Ihren Netzbetreiber aus
|
196
197
|
submit: Schicken
|
197
198
|
title: SMS
|
198
|
-
to:
|
199
|
+
to: "Telefonnummer:"
|
199
200
|
success: SMS verschickt
|
200
201
|
text:
|
201
|
-
url:
|
202
|
+
url: "Link: %{url}"
|
202
203
|
tools:
|
203
204
|
citation: Zitieren
|
204
205
|
clear: Löschen
|
@@ -39,18 +39,18 @@ es:
|
|
39
39
|
blank: Debe introducir un destinatario para enviar este mensaje
|
40
40
|
invalid: Debe entrar un email válido
|
41
41
|
form:
|
42
|
-
message:
|
42
|
+
message: "Mensaje:"
|
43
43
|
submit: Enviar
|
44
44
|
title: Enviar
|
45
|
-
to:
|
45
|
+
to: "Email:"
|
46
46
|
success: Email enviado
|
47
47
|
text:
|
48
48
|
default_title: N/A
|
49
|
-
message:
|
49
|
+
message: "Mensaje: %{message}"
|
50
50
|
subject:
|
51
|
-
one:
|
51
|
+
one: "Ficha artículo: %{title}"
|
52
52
|
other: Ficha artículos
|
53
|
-
url:
|
53
|
+
url: "URL: %{url}"
|
54
54
|
entry_name:
|
55
55
|
default:
|
56
56
|
one: entrada
|
@@ -102,15 +102,15 @@ es:
|
|
102
102
|
count: Ordenación numérica
|
103
103
|
index: Ordenación A-Z
|
104
104
|
suggest:
|
105
|
-
label:
|
106
|
-
placeholder:
|
105
|
+
label: Filtro %{field_label}
|
106
|
+
placeholder: Filtrar...
|
107
107
|
title: Limite su búsqueda
|
108
108
|
filters:
|
109
109
|
label: "%{label}:"
|
110
110
|
remove:
|
111
|
-
label_value:
|
111
|
+
label_value: "Eliminar la restricción%{label}: %{value}"
|
112
112
|
value: Eliminar la restricción %{value}
|
113
|
-
title:
|
113
|
+
title: "Usted ha buscado:"
|
114
114
|
form:
|
115
115
|
search:
|
116
116
|
label: buscar
|
@@ -129,6 +129,7 @@ es:
|
|
129
129
|
constraint: "%{label}: %{value}"
|
130
130
|
many_constraint_values: "%{values} seleccionado"
|
131
131
|
title: "%{constraints} - %{application_name} Resultados de la búsqueda"
|
132
|
+
joiner: " / "
|
132
133
|
pagination:
|
133
134
|
title: Resultados de navegación
|
134
135
|
pagination_info:
|
@@ -157,7 +158,7 @@ es:
|
|
157
158
|
start_over: Volver a empezar
|
158
159
|
view:
|
159
160
|
list: Lista
|
160
|
-
view_title:
|
161
|
+
view_title: "Ver Resultados por: "
|
161
162
|
zero_results:
|
162
163
|
modify_search: Intente modificar su búsqueda
|
163
164
|
search_everything: Pruebe a buscar de todo
|
@@ -194,10 +195,10 @@ es:
|
|
194
195
|
carrier_prompt: Por favor, seleccione su compañía telefónica
|
195
196
|
submit: Enviar
|
196
197
|
title: Enviar SMS
|
197
|
-
to:
|
198
|
+
to: "Número de teléfono:"
|
198
199
|
success: SMS enviado
|
199
200
|
text:
|
200
|
-
url:
|
201
|
+
url: "Link: %{url}"
|
201
202
|
tools:
|
202
203
|
citation: Cité
|
203
204
|
clear: Borrar
|