blacklight 9.2.1 → 9.3.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.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.github/matrix.json +4 -4
  3. data/.github/workflows/build.yml +3 -0
  4. data/.github/workflows/lint.yml +17 -2
  5. data/.github/workflows/main.yml +3 -0
  6. data/.github/workflows/release_7_x_scheduled.yml +3 -0
  7. data/.github/workflows/release_8_x_scheduled.yml +3 -0
  8. data/.github/workflows/test.yml +3 -2
  9. data/.gitignore +0 -1
  10. data/.prettierignore +5 -0
  11. data/.prettierrc.json +4 -0
  12. data/.rubocop.yml +4 -0
  13. data/.rubocop_todo.yml +0 -143
  14. data/VERSION +1 -1
  15. data/app/assets/builds/blacklight.css +39 -9
  16. data/app/assets/javascripts/blacklight/blacklight.esm.js +207 -125
  17. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  18. data/app/assets/javascripts/blacklight/blacklight.js +207 -125
  19. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  20. data/app/assets/stylesheets/blacklight/_search_results.scss +24 -0
  21. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +18 -3
  22. data/app/components/blacklight/constraints_component.rb +2 -1
  23. data/app/components/blacklight/facet_field_component.rb +1 -1
  24. data/app/components/blacklight/open_graph_metadata_component.rb +33 -0
  25. data/app/components/blacklight/search/sidebar_component.html.erb +2 -2
  26. data/app/components/blacklight/search/sidebar_component.rb +3 -2
  27. data/app/controllers/concerns/blacklight/catalog.rb +3 -5
  28. data/app/controllers/concerns/blacklight/controller.rb +2 -6
  29. data/app/controllers/concerns/blacklight/search_context.rb +2 -7
  30. data/app/controllers/concerns/blacklight/token_based_user.rb +2 -6
  31. data/app/helpers/blacklight/catalog_helper_behavior.rb +9 -9
  32. data/app/helpers/blacklight/url_helper_behavior.rb +2 -7
  33. data/app/javascript/blacklight-frontend/bookmark_toggle.js +10 -8
  34. data/app/javascript/blacklight-frontend/checkbox_submit.js +42 -33
  35. data/app/javascript/blacklight-frontend/color_theme_switcher.js +47 -16
  36. data/app/javascript/blacklight-frontend/core.js +18 -19
  37. data/app/javascript/blacklight-frontend/debounce.js +7 -5
  38. data/app/javascript/blacklight-frontend/facet_suggest.js +27 -25
  39. data/app/javascript/blacklight-frontend/index.js +1 -1
  40. data/app/javascript/blacklight-frontend/modal.js +69 -52
  41. data/app/javascript/blacklight-frontend/search_context.js +36 -17
  42. data/app/models/blacklight/facet_paginator.rb +1 -3
  43. data/app/presenters/blacklight/document_presenter.rb +10 -1
  44. data/app/presenters/blacklight/facet_grouped_item_presenter.rb +1 -3
  45. data/app/presenters/blacklight/facet_item_pivot_presenter.rb +0 -8
  46. data/app/presenters/blacklight/json_presenter.rb +1 -3
  47. data/app/presenters/blacklight/open_graph_presenter.rb +34 -0
  48. data/app/presenters/blacklight/thumbnail_presenter.rb +24 -1
  49. data/app/services/blacklight/field_retriever.rb +1 -3
  50. data/app/services/blacklight/search_service.rb +1 -1
  51. data/app/views/catalog/_document.atom.builder +3 -5
  52. data/app/views/catalog/_show_main_content.html.erb +1 -0
  53. data/app/views/catalog/index.atom.builder +8 -4
  54. data/app/views/layouts/blacklight/base.html.erb +7 -1
  55. data/config/i18n-tasks.yml +1 -1
  56. data/config/locales/blacklight.ja.yml +256 -0
  57. data/lib/blacklight/configuration/context.rb +1 -1
  58. data/lib/blacklight/configuration/fields.rb +3 -9
  59. data/lib/blacklight/configuration/view_config.rb +16 -0
  60. data/lib/blacklight/configuration.rb +6 -2
  61. data/lib/blacklight/engine.rb +2 -4
  62. data/lib/blacklight/search_builder.rb +4 -4
  63. data/lib/blacklight/search_state/filter_field.rb +0 -1
  64. data/lib/blacklight/search_state.rb +2 -6
  65. data/lib/blacklight/solr/facet_paginator.rb +1 -1
  66. data/lib/blacklight/solr/repository.rb +1 -3
  67. data/lib/blacklight/solr/response/facets.rb +11 -9
  68. data/lib/blacklight/solr/response/spelling.rb +51 -47
  69. data/lib/blacklight/solr/search_builder_behavior.rb +14 -15
  70. data/lib/blacklight.rb +3 -9
  71. data/lib/generators/blacklight/assets/importmap_generator.rb +3 -3
  72. data/lib/generators/blacklight/assets_generator.rb +1 -1
  73. data/lib/railties/blacklight.rake +3 -5
  74. data/package-lock.json +1054 -0
  75. data/package.json +7 -4
  76. data/rollup.config.js +5 -7
  77. data/spec/components/blacklight/constraints_component_spec.rb +23 -1
  78. data/spec/components/blacklight/document/page_header_component_spec.rb +4 -4
  79. data/spec/components/blacklight/document_component_spec.rb +16 -3
  80. data/spec/components/blacklight/metadata_field_component_spec.rb +2 -2
  81. data/spec/components/blacklight/response/spellcheck_component_spec.rb +2 -2
  82. data/spec/components/blacklight/search_bar_component_spec.rb +1 -1
  83. data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +1 -1
  84. data/spec/components/blacklight/system/dropdown_component_spec.rb +1 -2
  85. data/spec/controllers/bookmarks_controller_spec.rb +3 -9
  86. data/spec/controllers/catalog_controller_spec.rb +56 -26
  87. data/spec/features/dark_mode_spec.rb +30 -0
  88. data/spec/features/did_you_mean_spec.rb +1 -1
  89. data/spec/features/facet_missing_spec.rb +3 -3
  90. data/spec/features/modal_spec.rb +2 -2
  91. data/spec/features/open_graph_spec.rb +43 -0
  92. data/spec/features/search_context_spec.rb +1 -1
  93. data/spec/fixtures/sample_solr_documents.yml +6 -0
  94. data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +11 -8
  95. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +1 -1
  96. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +5 -5
  97. data/spec/helpers/blacklight_helper_spec.rb +6 -4
  98. data/spec/helpers/catalog_helper_spec.rb +34 -8
  99. data/spec/lib/blacklight/configuration/session_tracking_config_spec.rb +2 -2
  100. data/spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb +2 -2
  101. data/spec/lib/blacklight/search_state/filter_field_spec.rb +1 -1
  102. data/spec/lib/blacklight/search_state/pivot_filter_field_spec.rb +1 -1
  103. data/spec/lib/blacklight/search_state_spec.rb +14 -19
  104. data/spec/lib/blacklight_spec.rb +5 -5
  105. data/spec/models/blacklight/configuration_spec.rb +1 -1
  106. data/spec/models/blacklight/document/cache_key_spec.rb +32 -12
  107. data/spec/models/blacklight/facet_paginator_spec.rb +5 -5
  108. data/spec/models/blacklight/icon_spec.rb +3 -3
  109. data/spec/models/blacklight/search_builder_spec.rb +21 -16
  110. data/spec/models/blacklight/solr/default_filter_query_builder_spec.rb +1 -1
  111. data/spec/models/blacklight/solr/document_spec.rb +8 -8
  112. data/spec/models/blacklight/solr/response/facets_spec.rb +5 -5
  113. data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -1
  114. data/spec/models/blacklight/solr/response/group_spec.rb +1 -1
  115. data/spec/models/blacklight/solr/response_spec.rb +18 -3
  116. data/spec/models/blacklight/solr/search_builder_behavior_spec.rb +46 -7
  117. data/spec/models/blacklight/suggest_search_spec.rb +1 -1
  118. data/spec/models/record_mailer_spec.rb +2 -2
  119. data/spec/models/search_spec.rb +7 -7
  120. data/spec/presenters/blacklight/document_presenter_spec.rb +19 -6
  121. data/spec/presenters/blacklight/facet_field_presenter_spec.rb +4 -4
  122. data/spec/presenters/blacklight/field_presenter_spec.rb +12 -9
  123. data/spec/presenters/blacklight/open_graph_presenter_spec.rb +56 -0
  124. data/spec/presenters/blacklight/rendering/pipeline_spec.rb +3 -3
  125. data/spec/presenters/blacklight/thumbnail_presenter_spec.rb +129 -13
  126. data/spec/routing/catalog_routing_spec.rb +1 -1
  127. data/spec/services/blacklight/field_retriever_spec.rb +1 -1
  128. data/spec/services/blacklight/search_service_spec.rb +8 -8
  129. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -3
  130. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -2
  131. data/spec/views/catalog/index.atom.builder_spec.rb +16 -20
  132. data/spec/views/shared/_user_util_links.html.erb_spec.rb +1 -1
  133. metadata +12 -2
@@ -5,50 +5,69 @@ const SearchContext = (e) => {
5
5
  }
6
6
  }
7
7
 
8
- SearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content
9
- SearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content
8
+ SearchContext.csrfToken = () =>
9
+ document.querySelector('meta[name=csrf-token]')?.content
10
+ SearchContext.csrfParam = () =>
11
+ document.querySelector('meta[name=csrf-param]')?.content
10
12
 
11
13
  // this is the Rails.handleMethod with a couple adjustments, described inline:
12
14
  // first, we're attaching this directly to the event handler, so we can check for meta-keys
13
- SearchContext.handleSearchContextMethod = function(event) {
15
+ SearchContext.handleSearchContextMethod = function (event) {
14
16
  const link = this
15
17
 
16
- // instead of using the normal href, we need to use the context href instead
17
- let href = link.getAttribute('data-context-href')
18
+ // instead of using the normal href, we need to use the context href instead.
19
+ // Only post to same-origin URLs, which also rules out javascript: URLs;
20
+ // otherwise fall through to the link's default behavior.
21
+ const contextUrl = new URL(
22
+ link.getAttribute('data-context-href'),
23
+ window.location.href,
24
+ )
25
+ if (contextUrl.origin !== window.location.origin) return
26
+
18
27
  let target = link.getAttribute('target')
19
28
  let csrfToken = SearchContext.csrfToken()
20
29
  let csrfParam = SearchContext.csrfParam()
21
30
  let form = document.createElement('form')
22
31
  form.method = 'post'
23
- form.action = href
32
+ form.action = contextUrl.href
24
33
 
34
+ const appendHiddenInput = (name, value) => {
35
+ const input = document.createElement('input')
36
+ input.type = 'hidden'
37
+ input.name = name
38
+ input.value = value
39
+ form.appendChild(input)
40
+ }
25
41
 
26
- let formContent = `<input name="_method" value="post" type="hidden" />
27
- <input name="redirect" value="${link.getAttribute('href')}" type="hidden" />`
42
+ appendHiddenInput('_method', 'post')
43
+ appendHiddenInput('redirect', link.getAttribute('href'))
28
44
 
29
45
  // check for meta keys.. if set, we should open in a new tab
30
- if(event.metaKey || event.ctrlKey) {
31
- form.dataset.turbo = "false";
32
- target = '_blank';
46
+ if (event.metaKey || event.ctrlKey) {
47
+ form.dataset.turbo = 'false'
48
+ target = '_blank'
33
49
  }
34
50
 
35
51
  if (csrfParam !== undefined && csrfToken !== undefined) {
36
- formContent += `<input name="${csrfParam}" value="${csrfToken}" type="hidden" />`
52
+ appendHiddenInput(csrfParam, csrfToken)
37
53
  }
38
54
 
39
55
  // Must trigger submit by click on a button, else "submit" event handler won't work!
40
56
  // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
41
- formContent += '<input type="submit" />'
57
+ const submit = document.createElement('input')
58
+ submit.type = 'submit'
59
+ form.appendChild(submit)
42
60
 
43
- if (target) { form.setAttribute('target', target); }
61
+ if (target) {
62
+ form.setAttribute('target', target)
63
+ }
44
64
 
45
65
  form.style.display = 'none'
46
- form.innerHTML = formContent
47
66
  document.body.appendChild(form)
48
- form.querySelector('[type="submit"]').click()
67
+ submit.click()
49
68
 
50
69
  event.preventDefault()
51
- };
70
+ }
52
71
 
53
72
  document.addEventListener('click', SearchContext)
54
73
 
@@ -91,9 +91,7 @@ module Blacklight
91
91
  # no way to make it make sense otherwise.
92
92
  resort_params = params.merge(request_keys[:sort] => sort_method, request_keys[:page] => nil)
93
93
 
94
- if sort_method == 'count'
95
- resort_params.except!(request_keys[:prefix])
96
- end
94
+ resort_params.except!(request_keys[:prefix]) if sort_method == 'count'
97
95
 
98
96
  resort_params
99
97
  end
@@ -5,8 +5,9 @@ module Blacklight
5
5
  class DocumentPresenter
6
6
  attr_reader :document, :configuration, :view_context
7
7
 
8
- class_attribute :thumbnail_presenter
8
+ class_attribute :thumbnail_presenter, :open_graph_presenter
9
9
  self.thumbnail_presenter = ThumbnailPresenter
10
+ self.open_graph_presenter = OpenGraphPresenter
10
11
 
11
12
  # @param [SolrDocument] document
12
13
  # @param [ActionView::Base] view_context scope for linking and generating urls
@@ -102,10 +103,18 @@ module Blacklight
102
103
  view_config.thumbnail_presenter || thumbnail_presenter
103
104
  end
104
105
 
106
+ def open_graph_presenter_class
107
+ view_config.open_graph_presenter || open_graph_presenter
108
+ end
109
+
105
110
  def thumbnail
106
111
  @thumbnail ||= thumbnail_presenter_class.new(document, view_context, view_config)
107
112
  end
108
113
 
114
+ def open_graph
115
+ @open_graph ||= open_graph_presenter_class.new(self)
116
+ end
117
+
109
118
  ##
110
119
  # Create <link rel="alternate"> links from a documents dynamically
111
120
  # provided export formats. Returns empty string if no links available.
@@ -34,9 +34,7 @@ module Blacklight
34
34
 
35
35
  # @private
36
36
  def add_href(_path_options = {})
37
- if facet_config.url_method
38
- return view_context.public_send(facet_config.url_method, facet_config.key, facet_item)
39
- end
37
+ return view_context.public_send(facet_config.url_method, facet_config.key, facet_item) if facet_config.url_method
40
38
 
41
39
  new_state = search_state.filter(facet_config).remove(@group)
42
40
  new_state = new_state.filter(facet_config).add(@group + [facet_item])
@@ -44,13 +44,5 @@ module Blacklight
44
44
  label_value.compact.join(" » ")
45
45
  end
46
46
  end
47
-
48
- def value
49
- if facet_item.respond_to? :value
50
- facet_item.value
51
- else
52
- facet_item
53
- end
54
- end
55
47
  end
56
48
  end
@@ -33,9 +33,7 @@ module Blacklight
33
33
  def pagination_info
34
34
  h = {}
35
35
 
36
- [:current_page, :next_page, :prev_page, :total_pages,
37
- :limit_value, :offset_value, :total_count,
38
- :first_page?, :last_page?].each do |k|
36
+ [:current_page, :next_page, :prev_page, :total_pages, :limit_value, :offset_value, :total_count, :first_page?, :last_page?].each do |k|
39
37
  h[k] = @response.send(k)
40
38
  end
41
39
 
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ # Derives open graph metadata tags for a document
5
+ class OpenGraphPresenter
6
+ # @param [Blacklight::DocumentPresenter] document_presenter
7
+ def initialize(document_presenter)
8
+ @presenter = document_presenter
9
+ end
10
+
11
+ attr_reader :presenter
12
+
13
+ delegate :document, :view_context, :configuration, to: :presenter
14
+
15
+ # Hash of property:content pairs that will become <meta> tags
16
+ def properties
17
+ {
18
+ 'og:type' => type,
19
+ 'og:title' => title,
20
+ 'og:description' => description,
21
+ 'og:image' => image
22
+ }.compact_blank
23
+ end
24
+
25
+ def type = 'website'
26
+ def title = presenter.html_title
27
+ def description = nil
28
+
29
+ def image
30
+ url = presenter.thumbnail.url
31
+ view_context.image_url(url) if url
32
+ end
33
+ end
34
+ end
@@ -18,6 +18,11 @@ module Blacklight
18
18
  thumbnail_value(image_options)
19
19
  end
20
20
 
21
+ # Only works for thumbnail_field, not thumbnail_method
22
+ def url
23
+ thumbnail_value_from_document if thumbnail_field
24
+ end
25
+
21
26
  ##
22
27
  # Does the document have a thumbnail to render?
23
28
  #
@@ -55,7 +60,25 @@ module Blacklight
55
60
  view_context.image_tag image_url, image_options if image_url.present?
56
61
  end
57
62
 
58
- value || default_thumbnail_value(image_options)
63
+ thumbnail_with_fallback(value, image_options)
64
+ end
65
+
66
+ # Stack the document's thumbnail over the default thumbnail, so the default
67
+ # shows through as a fallback while the thumbnail loads.
68
+ # @param [String] value the document's rendered thumbnail
69
+ # @param [Hash] image_options to pass to the fallback image tag
70
+ def thumbnail_with_fallback(value, image_options)
71
+ # If no thumbnail or no fallback, just render the other one directly
72
+ return default_thumbnail_value(image_options) if value.blank?
73
+
74
+ # The fallback shouldn't duplicate the ID of the real thumbnail
75
+ fallback = default_thumbnail_value(image_options.except(:id))
76
+ return value if fallback.blank?
77
+
78
+ # If we have both, stack them with the fallback underneath
79
+ view_context.tag.div(class: 'thumbnail-stack') do
80
+ view_context.safe_join([view_context.tag.div(fallback, class: 'thumbnail-fallback', aria: { hidden: true }), value])
81
+ end
59
82
  end
60
83
 
61
84
  def default_thumbnail_value(image_options)
@@ -22,9 +22,7 @@ module Blacklight
22
22
 
23
23
  # @return [Array]
24
24
  def fetch
25
- if field_config.highlight
26
- value = retrieve_highlight
27
- end
25
+ value = retrieve_highlight if field_config.highlight
28
26
  if value.blank?
29
27
  value = if field_config.accessor
30
28
  retieve_using_accessor
@@ -94,7 +94,7 @@ module Blacklight
94
94
  document_list = response.documents
95
95
 
96
96
  # only get the previous doc if there is one
97
- prev_doc = document_list.first if index > 0
97
+ prev_doc = document_list.first if index.positive?
98
98
  next_doc = document_list.last if (index + 1) < response.total
99
99
  [response, [prev_doc, next_doc]]
100
100
  end
@@ -14,9 +14,7 @@ xml.entry do
14
14
 
15
15
  xml.id polymorphic_url(search_state.url_for_document(document))
16
16
 
17
- if document.to_semantic_values.key? :author
18
- xml.author { xml.name(document.to_semantic_values[:author].first) }
19
- end
17
+ xml.author { xml.name(document.to_semantic_values[:author].first) } if document.to_semantic_values.key? :author
20
18
 
21
19
  with_format(:html) do
22
20
  xml.summary "type" => "html" do
@@ -26,8 +24,8 @@ xml.entry do
26
24
  end
27
25
 
28
26
  # If they asked for a format, give it to them.
29
- if (params["content_format"] &&
30
- document.export_formats[params["content_format"].to_sym])
27
+ if params["content_format"] &&
28
+ document.export_formats[params["content_format"].to_sym]
31
29
 
32
30
  type = document.export_formats[params["content_format"].to_sym][:content_type]
33
31
 
@@ -2,6 +2,7 @@
2
2
  <% presenter ||= document_presenter(@document) %>
3
3
 
4
4
  <% @page_title = t('blacklight.search.show.title', document_title: presenter.html_title, application_name: application_name).html_safe %>
5
+ <% content_for(:open_graph) { render blacklight_config.open_graph_component.new(presenter: presenter.open_graph) } %>
5
6
  <% content_for(:head) { render_link_rel_alternates } %>
6
7
 
7
8
  <%= render presenter.view_config.document_header_component.new(document: @document, search_context: @search_context, search_session: search_session) %>
@@ -16,11 +16,15 @@ xml.feed("xmlns" => "http://www.w3.org/2005/Atom",
16
16
 
17
17
  # Navigational and context links
18
18
 
19
- xml.link("rel" => "next",
20
- "href" => url_for(search_state.to_h.merge(only_path: false, page: @response.next_page.to_s))) if @response.next_page
19
+ if @response.next_page
20
+ xml.link("rel" => "next",
21
+ "href" => url_for(search_state.to_h.merge(only_path: false, page: @response.next_page.to_s)))
22
+ end
21
23
 
22
- xml.link("rel" => "previous",
23
- "href" => url_for(search_state.to_h.merge(only_path: false, page: @response.prev_page.to_s))) if @response.prev_page
24
+ if @response.prev_page
25
+ xml.link("rel" => "previous",
26
+ "href" => url_for(search_state.to_h.merge(only_path: false, page: @response.prev_page.to_s)))
27
+ end
24
28
 
25
29
  xml.link("rel" => "first",
26
30
  "href" => url_for(search_state.to_h.merge(only_path: false, page: "1")))
@@ -10,7 +10,12 @@
10
10
  <% if dark_mode_support? %>
11
11
  <script>
12
12
  (() => {
13
- const theme = localStorage.getItem('theme') || 'auto';
13
+ let theme = 'auto';
14
+ try {
15
+ theme = localStorage.getItem('theme') || 'auto';
16
+ } catch {
17
+ // localStorage may be unavailable (e.g. disabled or corrupt browser storage)
18
+ }
14
19
  if (theme === 'auto') {
15
20
  document.documentElement.setAttribute('data-bs-theme', window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
16
21
  } else {
@@ -32,6 +37,7 @@
32
37
  <% end %>
33
38
 
34
39
  <%= csrf_meta_tags %>
40
+ <%= content_for?(:open_graph) ? yield(:open_graph) : render(blacklight_config.open_graph_component.new) %>
35
41
  <%= content_for(:head) %>
36
42
  </head>
37
43
  <body class="<%= render_body_class %>">
@@ -1,6 +1,6 @@
1
1
  # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
2
2
  base_locale: en
3
- locales: [ar, de, es, fr, hu, it, nl, pt-BR, sq, zh]
3
+ locales: [ar, de, es, fr, hu, it, ja, nl, pt-BR, sq, zh]
4
4
  data:
5
5
  read:
6
6
  - config/locales/%{locale}.yml
@@ -0,0 +1,256 @@
1
+ ---
2
+ ja:
3
+ blacklight:
4
+ advanced_search:
5
+ any_of: "いずれか:"
6
+ form:
7
+ limit_criteria_heading_html: "<strong>かつ</strong>、次の条件に当てはまるもの"
8
+ query_criteria_heading_html: 以下の項目の%{select_menu}に一致
9
+ search_btn_html: 検索
10
+ search_context: 現在の検索条件
11
+ sort_label: 並び順
12
+ start_over_html: 条件をクリア
13
+ title: 詳細検索
14
+ more_options: 詳細検索
15
+ op:
16
+ label: 検索演算子
17
+ must: すべて
18
+ should: いずれか
19
+ or_html: " または "
20
+ page_title: 詳細検索 - %{application_name}
21
+ and: かつ
22
+ application_name: Blacklight
23
+ back_to_bookmarks: ブックマークに戻る
24
+ back_to_search: 検索結果に戻る
25
+ bookmarks:
26
+ add:
27
+ button: ブックマーク
28
+ failure: 申し訳ありません。ブックマークを保存できませんでした。
29
+ success:
30
+ one: ブックマークに追加しました。
31
+ other: ブックマークに追加しました。
32
+ clear:
33
+ action_confirm: ブックマークをすべて削除しますか?
34
+ action_title: ブックマークをすべて削除
35
+ failure: 申し訳ありません。ブックマークを削除できませんでした。
36
+ success: ブックマークをすべて削除しました。
37
+ delete: 削除
38
+ list_title: ブックマーク一覧
39
+ need_login: ブックマークを表示・管理するにはログインしてください。
40
+ no_bookmarks: ブックマークはありません
41
+ page_title: ブックマーク - %{application_name}
42
+ remove:
43
+ action_confirm: このブックマークを削除しますか?
44
+ button: ブックマークを削除
45
+ failure: 申し訳ありません。ブックマークを削除できませんでした。
46
+ success: ブックマークを削除しました。
47
+ title: ブックマーク
48
+ citation:
49
+ apa: APA
50
+ chicago: Chicago
51
+ mla: MLA
52
+ did_you_mean: "もしかして: %{options}"
53
+ email:
54
+ errors:
55
+ to:
56
+ blank: 送信するには宛先を入力してください
57
+ invalid: 有効なメールアドレスを入力してください
58
+ form:
59
+ message: "メッセージ:"
60
+ submit: 送信
61
+ title: メールで送信
62
+ to: "メールアドレス:"
63
+ success: メールを送信しました
64
+ text:
65
+ default_title: (タイトルなし)
66
+ message: "メッセージ: %{message}"
67
+ subject:
68
+ one: "資料レコード: %{title}"
69
+ other: 資料レコード
70
+ url: "URL: %{url}"
71
+ entry_name:
72
+ default:
73
+ one: 資料
74
+ other: 資料
75
+ grouped:
76
+ default:
77
+ one: グループ
78
+ other: グループ
79
+ header_links:
80
+ bookmarks: ブックマーク
81
+ login: ログイン
82
+ logout: ログアウト
83
+ search_history: 検索履歴
84
+ main:
85
+ aria:
86
+ main_container: メインコンテンツ
87
+ modal:
88
+ close: 閉じる
89
+ or: または
90
+ search:
91
+ atom_feed: 検索結果の Atom フィード
92
+ bookmarks:
93
+ absent: ブックマーク
94
+ inprogress: 保存中…
95
+ present: ブックマーク済み
96
+ documents:
97
+ aria:
98
+ limit_search: 検索結果の絞り込み
99
+ search_results: 検索結果
100
+ counter: "%{counter}. "
101
+ entry_pagination_info:
102
+ one: "<strong>1 件中 1 件目</strong>"
103
+ other: "<strong>%{total}</strong> 件中 <strong>%{current}</strong> 件目"
104
+ errors:
105
+ invalid_solr_id: 申し訳ありません。指定された資料は存在しません。
106
+ facets:
107
+ all: すべて
108
+ clear: 絞り込みを解除
109
+ count: "%{number}"
110
+ group:
111
+ close: 絞り込み項目を隠す
112
+ open: 絞り込み項目を表示
113
+ missing: "[値なし]"
114
+ more_html: <span class="visually-hidden">%{field_name}を</span>さらに表示 »
115
+ pivot:
116
+ hide: 隠す
117
+ show: 表示
118
+ selected:
119
+ remove: "[解除]"
120
+ sort:
121
+ count: 件数順
122
+ index: 名前順
123
+ suggest:
124
+ label: "%{field_label}を絞り込む"
125
+ placeholder: 絞り込み…
126
+ title: 絞り込み
127
+ filters:
128
+ label: "%{label}:"
129
+ remove:
130
+ label_value: "絞り込み条件「%{label}: %{value}」を解除"
131
+ value: 絞り込み条件「%{value}」を解除
132
+ title: "選択中の条件:"
133
+ form:
134
+ search:
135
+ label: 検索語
136
+ placeholder: 検索…
137
+ search_field:
138
+ label: 検索対象
139
+ post_label: で検索
140
+ title: 検索対象の項目
141
+ submit: 検索
142
+ group:
143
+ more: さらに表示 »
144
+ header: 検索
145
+ index:
146
+ label: "%{label}:"
147
+ page_title:
148
+ constraint: "%{label}: %{value}"
149
+ many_constraint_values: "%{values} 件選択"
150
+ title: "%{constraints} - %{application_name} 検索結果"
151
+ joiner: " / "
152
+ pagination:
153
+ title: 検索結果のページ送り
154
+ pagination_info:
155
+ no_items_found: 該当する%{entry_name}はありません
156
+ pages:
157
+ one: "<strong>%{total_num}</strong> 件中 <strong>%{start_num}</strong> - <strong>%{end_num}</strong> 件"
158
+ other: "<strong>%{total_num}</strong> 件中 <strong>%{start_num}</strong> - <strong>%{end_num}</strong> 件"
159
+ single_item_found: "<strong>1</strong> 件の%{entry_name}が見つかりました"
160
+ per_page:
161
+ aria_label: 検索結果のページ送り
162
+ button_label: "%{count} 件ずつ表示"
163
+ button_label_html: '%{count}<span class="d-none d-sm-inline"> 件ずつ表示</span>'
164
+ label: '%{count}<span class="visually-hidden"> 件ずつ表示</span>'
165
+ submit: 更新
166
+ title: 1ページあたりの表示件数
167
+ rss_feed: 検索結果の RSS フィード
168
+ search_results: 検索結果
169
+ show:
170
+ label: "%{label}:"
171
+ title: "%{document_title} - %{application_name}"
172
+ sort:
173
+ label: "並び順: %{field}"
174
+ label_html: '並び順<span class="d-none d-sm-inline">: %{field}</span>'
175
+ submit: 並べ替え
176
+ start_over: 検索をやり直す
177
+ view:
178
+ list: リスト
179
+ view_title: "表示形式: "
180
+ zero_results:
181
+ modify_search: 検索条件を変えてみてください
182
+ search_everything: すべての項目で検索する
183
+ search_fields: "%{search_fields}で検索しました"
184
+ title: 検索条件に一致する資料はありませんでした
185
+ use_fewer_keywords: キーワードを減らして検索し、左側のリンクで絞り込んでみてください。
186
+ search_history:
187
+ clear:
188
+ action_confirm: 検索履歴をすべて削除しますか?
189
+ action_title: 検索履歴を削除
190
+ failure: 検索履歴を削除できませんでした。
191
+ success: 検索履歴を削除しました。
192
+ forget: 削除
193
+ no_history: 検索履歴はありません
194
+ page_title: 検索履歴 - %{application_name}
195
+ recent: 最近の検索
196
+ save: 保存
197
+ title: 検索履歴
198
+ skip_links:
199
+ first_result: 最初の検索結果へ移動
200
+ label: スキップリンク
201
+ main_content: 本文へ移動
202
+ search_field: 検索欄へ移動
203
+ sms:
204
+ errors:
205
+ carrier:
206
+ blank: 携帯電話会社を選択してください
207
+ invalid: 有効な携帯電話会社を選択してください
208
+ to:
209
+ blank: 送信するには宛先の電話番号を入力してください
210
+ invalid: 有効な10桁の電話番号を入力してください
211
+ form:
212
+ carrier: 携帯電話会社
213
+ carrier_prompt: 携帯電話会社を選択してください
214
+ submit: 送信
215
+ title: SMS で送信
216
+ to: "電話番号:"
217
+ success: SMS を送信しました
218
+ text:
219
+ url: "リンク: %{url}"
220
+ theme:
221
+ auto: 自動
222
+ dark: ダーク
223
+ light: ライト
224
+ toggle: テーマを切り替え
225
+ tools:
226
+ citation: 引用
227
+ clear: クリア
228
+ email: メール
229
+ sms: SMS で送信
230
+ title: ツール
231
+ top_navbar:
232
+ aria:
233
+ container_label: メインナビゲーション
234
+ welcome: ようこそ
235
+ views:
236
+ pagination:
237
+ aria:
238
+ container_label: ページ送りのリンク
239
+ current_page: 現在のページ(%{page} ページ)
240
+ go_to_first_page: 最初のページへ
241
+ go_to_last_page: 最後のページへ
242
+ go_to_next_page: 次のページへ
243
+ go_to_page: "%{page} ページへ"
244
+ go_to_previous_page: 前のページへ
245
+ first: "&laquo; 最初"
246
+ last: 最後 &raquo;
247
+ next: 次へ &raquo;
248
+ previous: "&laquo; 前へ"
249
+ truncate: "…"
250
+ pagination_compact:
251
+ next: 次へ &raquo;
252
+ previous: "&laquo; 前へ"
253
+ layouts:
254
+ catalog_result:
255
+ aria:
256
+ sidebar: ツール
@@ -25,7 +25,7 @@ module Blacklight
25
25
  # @param [#if,#unless] config an object that responds to if/unless
26
26
  # @return [Boolean]
27
27
  def evaluate_if_unless_configuration(config, *)
28
- return config if config == true || config == false
28
+ return config if [true, false].include?(config)
29
29
 
30
30
  if_value = !config.respond_to?(:if) ||
31
31
  config.if.nil? ||
@@ -95,9 +95,7 @@ module Blacklight
95
95
  field_config_from_field_or_hash(config_key, *args)
96
96
  end
97
97
 
98
- if (field_config.field || field_config.key).to_s =~ /\*/
99
- field_config.match = Regexp.new("^#{(field_config.field || field_config.key).to_s.gsub('*', '.+')}$")
100
- end
98
+ field_config.match = Regexp.new("^#{(field_config.field || field_config.key).to_s.gsub('*', '.+')}$") if (field_config.field || field_config.key).to_s =~ /\*/
101
99
 
102
100
  # look up any dynamic fields
103
101
  if field_config.match
@@ -105,9 +103,7 @@ module Blacklight
105
103
  return
106
104
  end
107
105
 
108
- if block_given?
109
- yield field_config
110
- end
106
+ yield field_config if block_given?
111
107
 
112
108
  field_config.normalize!(self)
113
109
  field_config.validate!
@@ -140,9 +136,7 @@ module Blacklight
140
136
  end
141
137
 
142
138
  def reflected_fields
143
- if @table[:reflected_fields] == false
144
- return nil
145
- end
139
+ return nil if @table[:reflected_fields] == false
146
140
 
147
141
  @table[:reflected_fields] ||= Rails.cache.fetch("blacklight_configuration/admin/reflected_fields", expires_in: 1.hour) do
148
142
  repository.reflect_fields