blacklight 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.env +3 -3
- data/.github/matrix.json +12 -18
- data/.github/workflows/lint.yml +1 -1
- data/.github/workflows/test.yml +4 -3
- data/.rubocop.yml +72 -7
- data/.rubocop_todo.yml +142 -268
- data/Gemfile +1 -1
- data/README.md +2 -9
- data/VERSION +1 -1
- data/app/assets/builds/blacklight.css +37 -23
- data/app/assets/images/blacklight/logo-dark.svg +184 -0
- data/app/assets/images/blacklight/logo.svg +184 -0
- data/app/assets/javascripts/blacklight/blacklight.esm.js +128 -45
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +128 -45
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- data/app/assets/stylesheets/blacklight/_balanced_list.scss +1 -1
- data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +17 -0
- data/app/assets/stylesheets/blacklight/_constraints.scss +2 -2
- data/app/assets/stylesheets/blacklight/_facets.scss +14 -10
- data/app/assets/stylesheets/blacklight/_header.scss +0 -4
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +5 -9
- data/app/components/blacklight/facets/inclusive_constraint_component.html.erb +1 -1
- data/app/components/blacklight/icons/checkmark_component.rb +16 -0
- data/app/components/blacklight/icons/circle_half_component.rb +16 -0
- data/app/components/blacklight/icons/moon_stars_component.rb +17 -0
- data/app/components/blacklight/icons/sun_component.rb +16 -0
- data/app/components/blacklight/metadata_field_component.rb +1 -1
- data/app/components/blacklight/search_navbar_component.html.erb +1 -1
- data/app/components/blacklight/theme_switcher_component.html.erb +31 -0
- data/app/components/blacklight/theme_switcher_component.rb +6 -0
- data/app/components/blacklight/top_navbar_component.html.erb +1 -1
- data/app/controllers/concerns/blacklight/bookmarks.rb +8 -14
- data/app/controllers/concerns/blacklight/catalog.rb +9 -10
- data/app/controllers/concerns/blacklight/controller.rb +54 -11
- data/app/controllers/concerns/blacklight/guest_user.rb +51 -0
- data/app/controllers/concerns/blacklight/search_context.rb +1 -1
- data/app/controllers/concerns/blacklight/search_history.rb +3 -1
- data/app/controllers/concerns/blacklight/searchable.rb +18 -0
- data/app/helpers/blacklight/layout_helper_behavior.rb +7 -0
- data/app/javascript/blacklight-frontend/color_theme_switcher.js +85 -0
- data/app/javascript/blacklight-frontend/index.js +2 -0
- data/app/models/concerns/blacklight/document/dublin_core.rb +2 -2
- data/app/models/concerns/blacklight/document.rb +1 -1
- data/app/models/concerns/blacklight/user.rb +36 -0
- data/app/presenters/blacklight/field_presenter.rb +1 -1
- data/app/presenters/blacklight/rendering/microdata.rb +1 -0
- data/app/services/blacklight/bookmarks_search_builder.rb +4 -4
- data/app/services/blacklight/search_service.rb +46 -33
- data/app/values/blacklight/types.rb +1 -1
- data/app/views/catalog/_email_form.html.erb +3 -3
- data/app/views/catalog/_home_text.html.erb +1 -1
- data/app/views/catalog/_sms_form.html.erb +4 -4
- data/app/views/catalog/index.rss.builder +4 -4
- data/app/views/catalog/opensearch.json.jbuilder +3 -0
- data/app/views/catalog/opensearch.xml.builder +2 -2
- data/app/views/layouts/blacklight/base.html.erb +13 -1
- data/app/views/shared/_user_util_links.html.erb +18 -5
- data/blacklight.gemspec +3 -3
- data/config/locales/blacklight.ar.yml +5 -0
- data/config/locales/blacklight.ca.yml +5 -0
- data/config/locales/blacklight.de.yml +6 -2
- data/config/locales/blacklight.en.yml +5 -0
- data/config/locales/blacklight.es.yml +5 -0
- data/config/locales/blacklight.fr.yml +5 -0
- data/config/locales/blacklight.hu.yml +5 -0
- data/config/locales/blacklight.it.yml +6 -2
- data/config/locales/blacklight.nl.yml +5 -0
- data/config/locales/blacklight.pt-BR.yml +6 -2
- data/config/locales/blacklight.sq.yml +5 -0
- data/config/locales/blacklight.zh.yml +5 -0
- data/lib/blacklight/component.rb +1 -1
- data/lib/blacklight/configuration/action_config_map_entry.rb +31 -0
- data/lib/blacklight/configuration/display_field.rb +1 -0
- data/lib/blacklight/configuration/field.rb +6 -6
- data/lib/blacklight/configuration/fields.rb +1 -1
- data/lib/blacklight/configuration/sort_field.rb +2 -2
- data/lib/blacklight/configuration.rb +30 -19
- data/lib/blacklight/parameters.rb +1 -1
- data/lib/blacklight/search_builder.rb +58 -19
- data/lib/blacklight/search_state.rb +4 -0
- data/lib/blacklight/solr/request.rb +8 -1
- data/lib/blacklight/solr/response/group_response.rb +1 -1
- data/lib/blacklight/solr/response/spelling.rb +8 -8
- data/lib/blacklight/solr/response.rb +2 -21
- data/lib/blacklight/solr/search_builder_behavior.rb +3 -9
- data/lib/blacklight.rb +2 -2
- data/lib/generators/blacklight/assets/importmap_generator.rb +2 -2
- data/lib/generators/blacklight/assets_generator.rb +1 -1
- data/lib/generators/blacklight/controller_generator.rb +1 -1
- data/lib/generators/blacklight/document_generator.rb +1 -1
- data/lib/generators/blacklight/install_generator.rb +6 -4
- data/lib/generators/blacklight/models_generator.rb +1 -1
- data/lib/generators/blacklight/search_builder_generator.rb +1 -1
- data/lib/generators/blacklight/solr_generator.rb +1 -1
- data/lib/generators/blacklight/templates/catalog_controller.rb +20 -1
- data/lib/generators/blacklight/templates/solr/conf/schema.xml +264 -178
- data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +6 -14
- data/lib/generators/blacklight/test_support_generator.rb +1 -1
- data/lib/generators/blacklight/user_generator.rb +66 -5
- data/lib/railties/blacklight.rake +4 -4
- data/package.json +2 -2
- data/spec/components/blacklight/document/action_component_spec.rb +1 -1
- data/spec/components/blacklight/document/group_component_spec.rb +1 -1
- data/spec/components/blacklight/document_component_spec.rb +9 -9
- data/spec/components/blacklight/facet_component_spec.rb +2 -2
- data/spec/components/blacklight/facets/index_navigation_component_spec.rb +1 -2
- data/spec/components/blacklight/facets/list_component_spec.rb +1 -1
- data/spec/components/blacklight/facets/suggest_component_spec.rb +1 -2
- data/spec/components/blacklight/metadata_field_component_spec.rb +26 -0
- data/spec/components/blacklight/skip_link_component_spec.rb +2 -2
- data/spec/controllers/application_controller_spec.rb +71 -0
- data/spec/controllers/bookmarks_controller_spec.rb +18 -5
- data/spec/controllers/catalog_controller_spec.rb +7 -5
- data/spec/features/advanced_search_spec.rb +29 -16
- data/spec/features/alternate_controller_spec.rb +4 -4
- data/spec/features/axe_spec.rb +34 -22
- data/spec/features/bookmarks_spec.rb +13 -13
- data/spec/features/dark_mode_spec.rb +42 -0
- data/spec/features/did_you_mean_spec.rb +27 -27
- data/spec/features/facet_missing_spec.rb +3 -3
- data/spec/features/record_view_spec.rb +14 -14
- data/spec/features/search_context_spec.rb +8 -8
- data/spec/features/search_filters_spec.rb +16 -16
- data/spec/features/search_formats_spec.rb +2 -2
- data/spec/features/search_history_spec.rb +11 -11
- data/spec/features/search_pagination_spec.rb +17 -17
- data/spec/features/search_results_spec.rb +3 -3
- data/spec/features/search_sort_spec.rb +4 -4
- data/spec/features/search_spec.rb +20 -20
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +15 -15
- data/spec/helpers/blacklight_helper_spec.rb +1 -1
- data/spec/helpers/catalog_helper_spec.rb +7 -7
- data/spec/integration/generators/blacklight/user_generator_spec.rb +60 -0
- data/spec/lib/blacklight/search_state/pivot_filter_field_spec.rb +1 -1
- data/spec/models/blacklight/configurable_spec.rb +1 -1
- data/spec/models/blacklight/configuration_spec.rb +0 -19
- data/spec/models/blacklight/document/dublin_core_spec.rb +2 -2
- data/spec/models/blacklight/facet_paginator_spec.rb +1 -1
- data/spec/models/blacklight/search_builder_spec.rb +15 -3
- data/spec/models/blacklight/solr/repository_spec.rb +10 -2
- data/spec/models/blacklight/solr/search_builder_behavior_spec.rb +3 -5
- data/spec/models/blacklight/user_spec.rb +32 -5
- data/spec/models/bookmark_spec.rb +1 -1
- data/spec/models/record_mailer_spec.rb +8 -8
- data/spec/models/search_spec.rb +1 -1
- data/spec/models/solr_document_spec.rb +4 -0
- data/spec/presenters/blacklight/index_presenter_spec.rb +1 -0
- data/spec/presenters/blacklight/rendering/pipeline_spec.rb +1 -0
- data/spec/presenters/blacklight/show_presenter_spec.rb +1 -0
- data/spec/presenters/blacklight/thumbnail_presenter_spec.rb +1 -0
- data/spec/services/blacklight/search_service_spec.rb +7 -7
- data/spec/spec_helper.rb +3 -12
- data/spec/support/features/session_helpers.rb +13 -4
- data/spec/support/features/turbo_helpers.rb +13 -0
- data/spec/support/features.rb +2 -0
- data/spec/support/user_helpers.rb +24 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/spec/views/catalog/_document.html.erb_spec.rb +4 -4
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +2 -2
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +5 -5
- data/spec/views/catalog/index.html.erb_spec.rb +2 -2
- data/spec/views/catalog/show.html.erb_spec.rb +3 -4
- data/spec/views/shared/_user_util_links.html.erb_spec.rb +56 -0
- data/template.demo.rb +2 -1
- metadata +30 -22
- data/.hound.yml +0 -4
- data/.jshintrc +0 -22
- data/app/assets/images/blacklight/logo.png +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
method: :post do %>
|
|
6
6
|
<div class="modal-body">
|
|
7
7
|
<%= render '/shared/flash_msg' %>
|
|
8
|
-
<div class="row">
|
|
8
|
+
<div class="row mb-3">
|
|
9
9
|
<label class="col-form-label col-sm-2" for="to">
|
|
10
10
|
<%= t('blacklight.sms.form.to') %>
|
|
11
11
|
</label>
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
<%= telephone_field_tag :to, params[:to], class: 'form-control', required: true %>
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
|
-
<div class="row">
|
|
16
|
+
<div class="row mb-3">
|
|
17
17
|
<label class="col-form-label col-sm-2" for="carrier">
|
|
18
18
|
<%= t('blacklight.sms.form.carrier') %>
|
|
19
19
|
</label>
|
|
20
20
|
<div class="col-sm-10">
|
|
21
|
-
<%= select_tag(:carrier, options_for_select(sms_mappings.to_a.sort.unshift([t('blacklight.sms.form.carrier_prompt'),'']), params[:carrier]), class: 'form-control') %><br
|
|
21
|
+
<%= select_tag(:carrier, options_for_select(sms_mappings.to_a.sort.unshift([t('blacklight.sms.form.carrier_prompt'),'']), params[:carrier]), class: 'form-control') %><br>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
24
|
</div>
|
|
25
25
|
<% @documents&.each do |doc| %>
|
|
26
|
-
<%=hidden_field_tag "id[]", doc.id %>
|
|
26
|
+
<%= hidden_field_tag "id[]", doc.id %>
|
|
27
27
|
<% end %>
|
|
28
28
|
</div>
|
|
29
29
|
<div class="modal-footer">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
xml.instruct! :xml, version: "1.0"
|
|
4
|
-
xml.rss(version: "2.0")
|
|
5
|
-
xml.channel
|
|
4
|
+
xml.rss(version: "2.0") do
|
|
5
|
+
xml.channel do
|
|
6
6
|
xml.title(t('blacklight.search.page_title.title', constraints: render_search_to_page_title(params), application_name: application_name))
|
|
7
7
|
xml.link(search_action_url(search_state.to_h.merge(only_path: false)))
|
|
8
8
|
xml.description(t('blacklight.search.page_title.title', constraints: render_search_to_page_title(params), application_name: application_name))
|
|
@@ -10,5 +10,5 @@ xml.rss(version: "2.0") {
|
|
|
10
10
|
@response.documents.each_with_index do |document, document_counter|
|
|
11
11
|
xml << render_xml_partials(document, blacklight_config.view_config(:rss).partials, document_counter: document_counter)
|
|
12
12
|
end
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
xml.instruct! :xml, version: '1.0'
|
|
4
|
-
xml.OpenSearchDescription(xmlns: 'http://a9.com/-/spec/opensearch/1.1/')
|
|
4
|
+
xml.OpenSearchDescription(xmlns: 'http://a9.com/-/spec/opensearch/1.1/') do
|
|
5
5
|
xml.ShortName application_name
|
|
6
6
|
xml.Description "#{application_name} Search"
|
|
7
7
|
xml.Image asset_url('favicon.ico'), height: 16, width: 16, type: 'image/x-icon'
|
|
@@ -9,4 +9,4 @@ xml.OpenSearchDescription(xmlns: 'http://a9.com/-/spec/opensearch/1.1/') {
|
|
|
9
9
|
xml.Url type: 'text/html', method: 'get', template: "#{url_for controller: 'catalog', only_path: false}?q={searchTerms}&page={startPage?}"
|
|
10
10
|
xml.Url type: 'application/rss+xml', method: 'get', template: "#{url_for controller: 'catalog', only_path: false}.rss?q={searchTerms}&page={startPage?}"
|
|
11
11
|
xml.Url type: 'application/x-suggestions+json', method: 'get', template: "#{url_for controller: 'catalog', action: 'opensearch', format: 'json', only_path: false}?q={searchTerms}"
|
|
12
|
-
|
|
12
|
+
end
|
|
@@ -6,9 +6,21 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
7
7
|
|
|
8
8
|
<title><%= render_page_title %></title>
|
|
9
|
+
|
|
10
|
+
<% if dark_mode_support? %>
|
|
9
11
|
<script>
|
|
10
|
-
|
|
12
|
+
(() => {
|
|
13
|
+
const theme = localStorage.getItem('theme') || 'auto';
|
|
14
|
+
if (theme === 'auto') {
|
|
15
|
+
document.documentElement.setAttribute('data-bs-theme', window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
16
|
+
} else {
|
|
17
|
+
document.documentElement.setAttribute('data-bs-theme', theme);
|
|
18
|
+
}
|
|
19
|
+
document.querySelector('html').classList.remove('no-js');
|
|
20
|
+
})();
|
|
11
21
|
</script>
|
|
22
|
+
<% end %>
|
|
23
|
+
|
|
12
24
|
<%= opensearch_description_tag application_name, opensearch_catalog_url(format: 'xml') %>
|
|
13
25
|
<%= favicon_link_tag %>
|
|
14
26
|
<%= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload" %>
|
|
@@ -4,19 +4,32 @@
|
|
|
4
4
|
<% end %>
|
|
5
5
|
|
|
6
6
|
<% if has_user_authentication_provider? %>
|
|
7
|
-
<% if current_user %>
|
|
7
|
+
<% user = current_user if respond_to?(:current_user) %>
|
|
8
|
+
<% if user %>
|
|
9
|
+
<% if blacklight_logout_path %>
|
|
8
10
|
<li class="nav-item">
|
|
9
|
-
<%= link_to t('blacklight.header_links.logout'),
|
|
11
|
+
<%= link_to t('blacklight.header_links.logout'), blacklight_logout_path, { class: 'nav-link' }.merge(blacklight_logout_link_options) %>
|
|
10
12
|
</li>
|
|
11
|
-
<%
|
|
13
|
+
<% end %>
|
|
14
|
+
<% if blacklight_account_path && user.to_s.present? -%>
|
|
12
15
|
<li class="nav-item">
|
|
13
|
-
<%= link_to
|
|
16
|
+
<%= link_to user, blacklight_account_path, class: 'nav-link' %>
|
|
14
17
|
</li>
|
|
15
18
|
<% end %>
|
|
16
19
|
<% else %>
|
|
20
|
+
<% if blacklight_login_path %>
|
|
17
21
|
<li class="nav-item">
|
|
18
|
-
<%= link_to t('blacklight.header_links.login'),
|
|
22
|
+
<%= link_to t('blacklight.header_links.login'), blacklight_login_path, class: 'nav-link' %>
|
|
19
23
|
</li>
|
|
20
24
|
<% end %>
|
|
25
|
+
<% end %>
|
|
26
|
+
<% end %>
|
|
27
|
+
|
|
28
|
+
<% if dark_mode_support? %>
|
|
29
|
+
<li class="nav-item py-2 py-md-1 col-12 col-md-auto">
|
|
30
|
+
<div class="vr d-none d-md-flex h-100 mx-md-2 text-white"></div>
|
|
31
|
+
<hr class="d-md-none my-2 text-white-50">
|
|
32
|
+
</li>
|
|
33
|
+
<%= render Blacklight::ThemeSwitcherComponent.new %>
|
|
21
34
|
<% end %>
|
|
22
35
|
</ul>
|
data/blacklight.gemspec
CHANGED
|
@@ -23,15 +23,15 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
24
|
s.require_paths = ["lib"]
|
|
25
25
|
|
|
26
|
-
s.required_ruby_version = '>= 3.
|
|
26
|
+
s.required_ruby_version = '>= 3.3'
|
|
27
27
|
|
|
28
|
-
s.add_dependency "rails", '>= 7.
|
|
28
|
+
s.add_dependency "rails", '>= 7.2', '< 9'
|
|
29
29
|
s.add_dependency "globalid"
|
|
30
30
|
s.add_dependency "jbuilder", '~> 2.7'
|
|
31
31
|
s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
|
|
32
32
|
s.add_dependency "i18n", '>= 1.7.0' # added named parameters
|
|
33
33
|
s.add_dependency "ostruct", '>= 0.3.2'
|
|
34
|
-
s.add_dependency "view_component", '
|
|
34
|
+
s.add_dependency "view_component", '~> 4.0'
|
|
35
35
|
s.add_dependency "zeitwerk"
|
|
36
36
|
|
|
37
37
|
s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
|
|
@@ -91,8 +91,7 @@ de:
|
|
|
91
91
|
group:
|
|
92
92
|
close: Facetten ausblenden
|
|
93
93
|
open: Facetten zeigen
|
|
94
|
-
missing:
|
|
95
|
-
- fehlt
|
|
94
|
+
missing: "[fehlt]"
|
|
96
95
|
more_html: mehr <span class="visually-hidden">%{field_name}</span> »
|
|
97
96
|
pivot:
|
|
98
97
|
hide: Schließen
|
|
@@ -199,6 +198,11 @@ de:
|
|
|
199
198
|
success: SMS verschickt
|
|
200
199
|
text:
|
|
201
200
|
url: "Link: %{url}"
|
|
201
|
+
theme:
|
|
202
|
+
auto: Automatisch
|
|
203
|
+
dark: Dunkel
|
|
204
|
+
light: Hell
|
|
205
|
+
toggle: Design umschalten
|
|
202
206
|
tools:
|
|
203
207
|
citation: Zitieren
|
|
204
208
|
clear: Löschen
|
|
@@ -91,8 +91,7 @@ it:
|
|
|
91
91
|
group:
|
|
92
92
|
close: Nascondi sfaccettature
|
|
93
93
|
open: Mostra sfaccettature
|
|
94
|
-
missing:
|
|
95
|
-
- Mancante
|
|
94
|
+
missing: "[Mancante]"
|
|
96
95
|
more_html: altri <span class="visually-hidden">%{field_name}</span> »
|
|
97
96
|
pivot:
|
|
98
97
|
hide: Chiudi
|
|
@@ -199,6 +198,11 @@ it:
|
|
|
199
198
|
success: SMS inviato
|
|
200
199
|
text:
|
|
201
200
|
url: "Link: %{url}"
|
|
201
|
+
theme:
|
|
202
|
+
auto: Automatico
|
|
203
|
+
dark: Scuro
|
|
204
|
+
light: Chiaro
|
|
205
|
+
toggle: Cambia tema
|
|
202
206
|
tools:
|
|
203
207
|
citation: Cita
|
|
204
208
|
clear: Cancella
|
|
@@ -89,8 +89,7 @@ pt-BR:
|
|
|
89
89
|
group:
|
|
90
90
|
close: Ocultar facetas
|
|
91
91
|
open: Mostrar facetas
|
|
92
|
-
missing:
|
|
93
|
-
- Ausência
|
|
92
|
+
missing: "[Ausência]"
|
|
94
93
|
more_html: mais <span class="visually-hidden">%{field_name}</span> »
|
|
95
94
|
pivot:
|
|
96
95
|
hide: Fechar
|
|
@@ -197,6 +196,11 @@ pt-BR:
|
|
|
197
196
|
success: SMS Enviado
|
|
198
197
|
text:
|
|
199
198
|
url: "Link: %{url}"
|
|
199
|
+
theme:
|
|
200
|
+
auto: Automático
|
|
201
|
+
dark: Escuro
|
|
202
|
+
light: Claro
|
|
203
|
+
toggle: Alternar tema
|
|
200
204
|
tools:
|
|
201
205
|
citation: Citar
|
|
202
206
|
clear: Limpar
|
data/lib/blacklight/component.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Blacklight
|
|
|
15
15
|
# provided by Blacklight.
|
|
16
16
|
def sidecar_files(*args, **kwargs)
|
|
17
17
|
upstream_sidecar_files(*args, **kwargs).map do |path|
|
|
18
|
-
components_path =
|
|
18
|
+
components_path = config.generate.path
|
|
19
19
|
|
|
20
20
|
app_path = Rails.root.join(path.slice(path.index(components_path)..-1).to_s).to_s
|
|
21
21
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Blacklight
|
|
4
|
+
class Configuration::ActionConfigMapEntry < OpenStructWithHashAccess
|
|
5
|
+
# @!attribute parent_action_key
|
|
6
|
+
# Pull in the configuration for this action from another action's config
|
|
7
|
+
# @return [Symbol]
|
|
8
|
+
|
|
9
|
+
def parent_config = parent_action_key
|
|
10
|
+
|
|
11
|
+
def parent_config=(value)
|
|
12
|
+
self.parent_action_key = value
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
#
|
|
16
|
+
# @!attribute blacklight_config_property
|
|
17
|
+
# Pull in the configuration for this action from a top-level config
|
|
18
|
+
# @return [Symbol]
|
|
19
|
+
|
|
20
|
+
def top_level_config = blacklight_config_property
|
|
21
|
+
|
|
22
|
+
def top_level_config=(value)
|
|
23
|
+
self.blacklight_config_property = value
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
#
|
|
27
|
+
# @!attribute default
|
|
28
|
+
# Pull in additional default configuration for this action from a top-level config
|
|
29
|
+
# @return [Array<Symbol>]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -17,20 +17,20 @@ module Blacklight
|
|
|
17
17
|
|
|
18
18
|
def normalize! _blacklight_config = nil
|
|
19
19
|
self.field ||= key
|
|
20
|
-
self.key ||=
|
|
20
|
+
self.key ||= field
|
|
21
21
|
|
|
22
22
|
self.label ||= default_label
|
|
23
23
|
|
|
24
24
|
self.if = true if self.if.nil?
|
|
25
25
|
self.unless = false if self.unless.nil?
|
|
26
26
|
|
|
27
|
-
self.field &&=
|
|
27
|
+
self.field &&= field.to_s
|
|
28
28
|
|
|
29
29
|
self
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def validate!
|
|
33
|
-
raise ArgumentError, "Must supply a field name" if
|
|
33
|
+
raise ArgumentError, "Must supply a field name" if field.nil?
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def display_label(context = nil, **)
|
|
@@ -44,10 +44,10 @@ module Blacklight
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def default_label
|
|
47
|
-
if
|
|
48
|
-
|
|
47
|
+
if key.respond_to?(:titleize)
|
|
48
|
+
key.titleize
|
|
49
49
|
else
|
|
50
|
-
|
|
50
|
+
key.to_s.titleize
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -146,7 +146,7 @@ module Blacklight
|
|
|
146
146
|
|
|
147
147
|
@table[:reflected_fields] ||= Rails.cache.fetch("blacklight_configuration/admin/reflected_fields", expires_in: 1.hour) do
|
|
148
148
|
repository.reflect_fields
|
|
149
|
-
rescue => e
|
|
149
|
+
rescue StandardError => e
|
|
150
150
|
Blacklight.logger&.warn "Error retrieving field metadata: #{e}"
|
|
151
151
|
false
|
|
152
152
|
end
|
|
@@ -10,13 +10,13 @@ module Blacklight
|
|
|
10
10
|
self.field ||= label&.parameterize
|
|
11
11
|
self.field ||= sort
|
|
12
12
|
|
|
13
|
-
self.sort ||=
|
|
13
|
+
self.sort ||= field
|
|
14
14
|
|
|
15
15
|
self
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def validate!
|
|
19
|
-
raise ArgumentError.new, "Must supply a sort string" if
|
|
19
|
+
raise ArgumentError.new, "Must supply a sort string" if sort.nil?
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -47,6 +47,12 @@ module Blacklight
|
|
|
47
47
|
property :header_component, default: Blacklight::HeaderComponent
|
|
48
48
|
property :full_width_layout, default: false
|
|
49
49
|
|
|
50
|
+
# @!attribute dark_mode_support
|
|
51
|
+
# @since v9.1.0
|
|
52
|
+
# @return [Boolean] Whether to enable the light/dark mode them switcher.
|
|
53
|
+
# @note Requires Bootstrap v5.3+; see: https://getbootstrap.com/docs/5.3/customize/color-modes/#dark-mode
|
|
54
|
+
property :dark_mode_support, default: true
|
|
55
|
+
|
|
50
56
|
bootstrap_version = ENV['BOOTSTRAP_VERSION'].presence || "5"
|
|
51
57
|
property :bootstrap_version, default: /(\d)(?:\.\d){0,2}/.match(bootstrap_version)[1].to_i
|
|
52
58
|
|
|
@@ -208,14 +214,14 @@ module Blacklight
|
|
|
208
214
|
|
|
209
215
|
# @!attribute action_mapping
|
|
210
216
|
# @since v7.16.0
|
|
211
|
-
# @return [Hash{Symbol => Blacklight::Configuration::
|
|
217
|
+
# @return [Hash{Symbol => Blacklight::Configuration::ActionConfigMapEntry}]
|
|
212
218
|
property :action_mapping, default: NestedOpenStructWithHashAccess.new(
|
|
213
|
-
|
|
214
|
-
default: {
|
|
215
|
-
show: {
|
|
216
|
-
citation: {
|
|
217
|
-
email_record: {
|
|
218
|
-
sms_record: {
|
|
219
|
+
ActionConfigMapEntry,
|
|
220
|
+
default: { blacklight_config_property: :index, default: [:index] },
|
|
221
|
+
show: { blacklight_config_property: :show },
|
|
222
|
+
citation: { parent_action_key: :show },
|
|
223
|
+
email_record: { blacklight_config_property: :email },
|
|
224
|
+
sms_record: { blacklight_config_property: :sms }
|
|
219
225
|
)
|
|
220
226
|
|
|
221
227
|
# @!attribute sms
|
|
@@ -548,7 +554,7 @@ module Blacklight
|
|
|
548
554
|
conf.klass = klass
|
|
549
555
|
end
|
|
550
556
|
end
|
|
551
|
-
|
|
557
|
+
alias inheritable_copy build
|
|
552
558
|
|
|
553
559
|
# Get a view configuration for the given view type + action. The effective
|
|
554
560
|
# view configuration is inherited from:
|
|
@@ -570,12 +576,7 @@ module Blacklight
|
|
|
570
576
|
view_type = nil
|
|
571
577
|
end
|
|
572
578
|
|
|
573
|
-
@view_config[[view_type, action_name]] ||= if view_type
|
|
574
|
-
action_config(action_name)
|
|
575
|
-
else
|
|
576
|
-
base_config = action_config(action_name)
|
|
577
|
-
base_config.merge(view.fetch(view_type, {}))
|
|
578
|
-
end
|
|
579
|
+
@view_config[[view_type, action_name]] ||= action_config(action_name, (view.fetch(view_type, nil) if view_type))
|
|
579
580
|
end
|
|
580
581
|
|
|
581
582
|
# YARD will include inline disabling as docs, cannot do multiline inside @!macro. AND this must be separate from doc block.
|
|
@@ -688,8 +689,8 @@ module Blacklight
|
|
|
688
689
|
end
|
|
689
690
|
end
|
|
690
691
|
|
|
691
|
-
def action_config(
|
|
692
|
-
action_config = action_mapping[
|
|
692
|
+
def action_config(action_name, view_type_specific_config, default: :index)
|
|
693
|
+
action_config = action_mapping[action_name]
|
|
693
694
|
action_config ||= action_mapping[:default]
|
|
694
695
|
|
|
695
696
|
if action_config.parent_config && action_config.parent_config != :default
|
|
@@ -700,9 +701,19 @@ module Blacklight
|
|
|
700
701
|
end
|
|
701
702
|
action_config = action_config.reverse_merge(action_mapping[:default]) if action_config != action_mapping[:default]
|
|
702
703
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
704
|
+
view_config = if action_config.blacklight_config_property
|
|
705
|
+
self[action_config.blacklight_config_property]
|
|
706
|
+
else
|
|
707
|
+
self[default]
|
|
708
|
+
end
|
|
709
|
+
|
|
710
|
+
view_config = Array(action_config.default - [action_config.blacklight_config_property || default]).inject(view_config) do |config, top_level_config|
|
|
711
|
+
config.reverse_merge(self[top_level_config])
|
|
712
|
+
end
|
|
713
|
+
|
|
714
|
+
view_config = view_config.merge(view_type_specific_config) if view_type_specific_config
|
|
715
|
+
|
|
716
|
+
view_config
|
|
706
717
|
end
|
|
707
718
|
end
|
|
708
719
|
end
|
|
@@ -79,7 +79,7 @@ module Blacklight
|
|
|
79
79
|
# Facebook's crawler turns array query parameters into a hash with numeric keys. Once we know
|
|
80
80
|
# the expected parameter structure, we can unmangle those parameters to match our expected values.
|
|
81
81
|
def deep_unmangle_params!(params, permitted_params)
|
|
82
|
-
permitted_params.
|
|
82
|
+
permitted_params.grep(Hash).each do |permission|
|
|
83
83
|
permission.each do |key, permitted_value|
|
|
84
84
|
next unless params[key].is_a?(ActionController::Parameters)
|
|
85
85
|
|