blacklight 8.0.0.beta4 → 8.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop_todo.yml +3 -1
  4. data/Gemfile +0 -4
  5. data/README.md +1 -1
  6. data/Rakefile +18 -0
  7. data/VERSION +1 -1
  8. data/app/assets/config/blacklight/manifest.js +3 -0
  9. data/app/assets/stylesheets/blacklight/_facets.scss +32 -5
  10. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +1 -1
  11. data/app/components/blacklight/document_component.rb +44 -18
  12. data/app/components/blacklight/document_metadata_component.html.erb +4 -2
  13. data/app/components/blacklight/document_metadata_component.rb +8 -2
  14. data/app/components/blacklight/metadata_field_layout_component.rb +7 -4
  15. data/app/components/blacklight/metadata_field_plain_text_layout_component.rb +17 -0
  16. data/app/components/blacklight/response/facet_group_component.html.erb +2 -1
  17. data/app/components/blacklight/response/sort_component.rb +1 -1
  18. data/app/components/blacklight/response/spellcheck_component.rb +1 -1
  19. data/app/components/blacklight/response/view_type_button_component.rb +1 -1
  20. data/app/components/blacklight/response/view_type_component.rb +1 -1
  21. data/app/components/blacklight/search_context/server_applied_params_component.html.erb +4 -0
  22. data/app/components/blacklight/search_context/server_applied_params_component.rb +13 -0
  23. data/app/components/blacklight/{search_context_component.html.erb → search_context/server_item_pagination_component.html.erb} +0 -0
  24. data/app/components/blacklight/search_context/server_item_pagination_component.rb +71 -0
  25. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  26. data/app/components/blacklight/system/flash_message_component.rb +1 -1
  27. data/app/components/blacklight/system/modal_component.rb +1 -1
  28. data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
  29. data/app/controllers/concerns/blacklight/search_context.rb +46 -6
  30. data/app/helpers/blacklight/blacklight_helper_behavior.rb +0 -101
  31. data/app/helpers/blacklight/catalog_helper_behavior.rb +27 -54
  32. data/app/helpers/blacklight/component_helper_behavior.rb +0 -11
  33. data/app/helpers/blacklight/document_helper_behavior.rb +76 -0
  34. data/app/helpers/blacklight/layout_helper_behavior.rb +59 -0
  35. data/app/helpers/blacklight/url_helper_behavior.rb +11 -3
  36. data/app/javascript/blacklight/bookmark_toggle.js +8 -15
  37. data/app/javascript/blacklight/button_focus.js +10 -10
  38. data/app/javascript/blacklight/index.js +5 -5
  39. data/app/javascript/blacklight/modal.js +11 -16
  40. data/app/javascript/blacklight/search_context.js +51 -57
  41. data/app/models/concerns/blacklight/document.rb +11 -0
  42. data/app/models/record_mailer.rb +19 -15
  43. data/app/presenters/blacklight/document_presenter.rb +13 -11
  44. data/app/presenters/blacklight/index_presenter.rb +1 -1
  45. data/app/presenters/blacklight/rendering/abstract_step.rb +4 -0
  46. data/app/presenters/blacklight/rendering/join.rb +7 -1
  47. data/app/presenters/blacklight/rendering/link_to_facet.rb +1 -1
  48. data/app/presenters/blacklight/rendering/microdata.rb +1 -1
  49. data/app/services/blacklight/search_service.rb +2 -1
  50. data/app/views/catalog/_document.atom.builder +1 -1
  51. data/app/views/catalog/_document.html.erb +3 -8
  52. data/app/views/catalog/_document_list.html.erb +2 -1
  53. data/app/views/catalog/_show_main_content.html.erb +3 -9
  54. data/app/views/catalog/index.html.erb +3 -0
  55. data/app/views/catalog/show.html.erb +1 -6
  56. data/app/views/layouts/blacklight/base.html.erb +4 -4
  57. data/app/views/record_mailer/email_record.text.erb +4 -3
  58. data/app/views/record_mailer/sms_record.text.erb +4 -4
  59. data/blacklight.gemspec +1 -1
  60. data/config/importmap.rb +1 -1
  61. data/config/locales/blacklight.ar.yml +209 -232
  62. data/config/locales/blacklight.ca.yml +0 -6
  63. data/config/locales/blacklight.de.yml +197 -215
  64. data/config/locales/blacklight.en.yml +2 -6
  65. data/config/locales/blacklight.es.yml +196 -215
  66. data/config/locales/blacklight.fr.yml +196 -219
  67. data/config/locales/blacklight.hu.yml +193 -212
  68. data/config/locales/blacklight.it.yml +197 -215
  69. data/config/locales/blacklight.nl.yml +193 -212
  70. data/config/locales/blacklight.pt-BR.yml +195 -215
  71. data/config/locales/blacklight.sq.yml +193 -212
  72. data/config/locales/blacklight.zh.yml +194 -213
  73. data/lib/blacklight/configuration/session_tracking_config.rb +45 -0
  74. data/lib/blacklight/configuration/view_config.rb +0 -4
  75. data/lib/blacklight/configuration.rb +8 -4
  76. data/lib/blacklight/engine.rb +6 -7
  77. data/lib/blacklight/routes/searchable.rb +1 -0
  78. data/lib/generators/blacklight/assets/importmap_generator.rb +9 -2
  79. data/lib/generators/blacklight/assets/propshaft_generator.rb +11 -2
  80. data/lib/generators/blacklight/assets/sprockets_generator.rb +2 -0
  81. data/lib/generators/blacklight/templates/solr_document.rb +0 -6
  82. data/package.json +7 -4
  83. data/rollup.config.js +11 -1
  84. data/spec/components/blacklight/document_component_spec.rb +9 -4
  85. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +29 -0
  86. data/spec/components/blacklight/{search_context_component_spec.rb → search_context/server_item_pagination_component_spec.rb} +15 -4
  87. data/spec/controllers/bookmarks_controller_spec.rb +1 -1
  88. data/spec/controllers/catalog_controller_spec.rb +17 -5
  89. data/spec/features/component_template_override_spec.rb +8 -0
  90. data/spec/features/modal_spec.rb +12 -0
  91. data/spec/features/sitelinks_search_box_spec.rb +13 -0
  92. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +1 -1
  93. data/spec/helpers/blacklight_helper_spec.rb +0 -56
  94. data/spec/helpers/catalog_helper_spec.rb +56 -0
  95. data/spec/lib/blacklight/configuration/session_tracking_config_spec.rb +38 -0
  96. data/spec/models/blacklight/icon_spec.rb +0 -2
  97. data/spec/models/record_mailer_spec.rb +36 -23
  98. data/spec/presenters/blacklight/document_presenter_spec.rb +1 -0
  99. data/spec/presenters/blacklight/field_presenter_spec.rb +2 -2
  100. data/spec/presenters/blacklight/index_presenter_spec.rb +1 -0
  101. data/spec/presenters/blacklight/show_presenter_spec.rb +1 -0
  102. data/spec/presenters/pipeline_spec.rb +13 -2
  103. data/spec/routing/catalog_routing_spec.rb +4 -0
  104. data/spec/spec_helper.rb +1 -1
  105. data/spec/support/view_component_test_helpers.rb +21 -0
  106. data/spec/test_app_templates/Gemfile.extra +4 -0
  107. data/spec/test_app_templates/lib/generators/test_app_generator.rb +8 -0
  108. data/spec/views/catalog/_document.html.erb_spec.rb +22 -1
  109. data/spec/views/catalog/_document_list.html.erb_spec.rb +7 -2
  110. data/tasks/blacklight.rake +1 -1
  111. metadata +24 -20
  112. data/app/assets/javascripts/blacklight/blacklight.esm.js +0 -390
  113. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +0 -1
  114. data/app/assets/javascripts/blacklight/blacklight.js +0 -398
  115. data/app/assets/javascripts/blacklight/blacklight.js.map +0 -1
  116. data/app/components/blacklight/search_context_component.rb +0 -68
  117. data/app/models/concerns/blacklight/document/email.rb +0 -27
  118. data/app/models/concerns/blacklight/document/sms.rb +0 -25
  119. data/spec/features/sitelinks_search_box.rb +0 -13
  120. data/spec/models/blacklight/document/email_spec.rb +0 -57
  121. data/spec/models/blacklight/document/sms_spec.rb +0 -58
  122. data/spec/support/view_component_capybara_test_helpers.rb +0 -8
@@ -1,59 +1,53 @@
1
- import Blacklight from './core'
2
-
3
- const SearchContext = (() => {
4
- Blacklight.doSearchContextBehavior = function() {
5
- document.addEventListener('click', (e) => {
6
- if (e.target.matches('[data-context-href]')) {
7
- Blacklight.handleSearchContextMethod.call(e.target, e)
8
- }
9
- })
10
- };
11
-
12
- Blacklight.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content
13
- Blacklight.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content
14
-
15
- // this is the Rails.handleMethod with a couple adjustments, described inline:
16
- // first, we're attaching this directly to the event handler, so we can check for meta-keys
17
- Blacklight.handleSearchContextMethod = function(event) {
18
- const link = this
19
-
20
- // instead of using the normal href, we need to use the context href instead
21
- let href = link.getAttribute('data-context-href')
22
- let target = link.getAttribute('target')
23
- let csrfToken = Blacklight.csrfToken()
24
- let csrfParam = Blacklight.csrfParam()
25
- let form = document.createElement('form')
26
- form.method = 'post'
27
- form.action = href
28
-
29
-
30
- let formContent = `<input name="_method" value="post" type="hidden" />
31
- <input name="redirect" value="${link.getAttribute('href')}" type="hidden" />`
32
-
33
- // check for meta keys.. if set, we should open in a new tab
34
- if(event.metaKey || event.ctrlKey) {
35
- target = '_blank';
36
- }
37
-
38
- if (csrfParam !== undefined && csrfToken !== undefined) {
39
- formContent += `<input name="${csrfParam}" value="${csrfToken}" type="hidden" />`
40
- }
41
-
42
- // Must trigger submit by click on a button, else "submit" event handler won't work!
43
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
44
- formContent += '<input type="submit" />'
45
-
46
- if (target) { form.setAttribute('target', target); }
47
-
48
- form.style.display = 'none'
49
- form.innerHTML = formContent
50
- document.body.appendChild(form)
51
- form.querySelector('[type="submit"]').click()
52
-
53
- event.preventDefault()
54
- };
55
-
56
- Blacklight.doSearchContextBehavior();
57
- })()
1
+ const SearchContext = (e) => {
2
+ if (e.target.matches('[data-context-href]')) {
3
+ SearchContext.handleSearchContextMethod.call(e.target, e)
4
+ }
5
+ }
6
+
7
+ SearchContext.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content
8
+ SearchContext.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content
9
+
10
+ // this is the Rails.handleMethod with a couple adjustments, described inline:
11
+ // first, we're attaching this directly to the event handler, so we can check for meta-keys
12
+ SearchContext.handleSearchContextMethod = function(event) {
13
+ const link = this
14
+
15
+ // instead of using the normal href, we need to use the context href instead
16
+ let href = link.getAttribute('data-context-href')
17
+ let target = link.getAttribute('target')
18
+ let csrfToken = SearchContext.csrfToken()
19
+ let csrfParam = SearchContext.csrfParam()
20
+ let form = document.createElement('form')
21
+ form.method = 'post'
22
+ form.action = href
23
+
24
+
25
+ let formContent = `<input name="_method" value="post" type="hidden" />
26
+ <input name="redirect" value="${link.getAttribute('href')}" type="hidden" />`
27
+
28
+ // check for meta keys.. if set, we should open in a new tab
29
+ if(event.metaKey || event.ctrlKey) {
30
+ target = '_blank';
31
+ }
32
+
33
+ if (csrfParam !== undefined && csrfToken !== undefined) {
34
+ formContent += `<input name="${csrfParam}" value="${csrfToken}" type="hidden" />`
35
+ }
36
+
37
+ // Must trigger submit by click on a button, else "submit" event handler won't work!
38
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
39
+ formContent += '<input type="submit" />'
40
+
41
+ if (target) { form.setAttribute('target', target); }
42
+
43
+ form.style.display = 'none'
44
+ form.innerHTML = formContent
45
+ document.body.appendChild(form)
46
+ form.querySelector('[type="submit"]').click()
47
+
48
+ event.preventDefault()
49
+ };
50
+
51
+ document.addEventListener('click', SearchContext)
58
52
 
59
53
  export default SearchContext
@@ -31,6 +31,17 @@ module Blacklight::Document
31
31
  class_attribute :inspector_fields, default: [:_source]
32
32
  end
33
33
 
34
+ Email = Module.new do
35
+ def self.included(mod)
36
+ Blacklight.deprecation.warn("Blacklight::Document::Email is deprecated and will be removed (included in #{mod}).")
37
+ end
38
+ end
39
+ Sms = Module.new do
40
+ def self.included(mod)
41
+ Blacklight.deprecation.warn("Blacklight::Document::Sms is deprecated and will be removed (included in #{mod}).")
42
+ end
43
+ end
44
+
34
45
  attr_reader :response, :_source
35
46
  alias_method :solr_response, :response
36
47
 
@@ -2,27 +2,21 @@
2
2
 
3
3
  # Only works for documents with a #to_marc right now.
4
4
  class RecordMailer < ApplicationMailer
5
- def email_record(documents, details, url_gen_params)
6
- title = begin
7
- title_field = details[:config].email.title_field
8
- if title_field
9
- [documents.first[title_field]].flatten.first
10
- else
11
- documents.first.to_semantic_values[:title]
12
- end
13
- rescue
14
- I18n.t('blacklight.email.text.default_title')
15
- end
16
-
17
- subject = I18n.t('blacklight.email.text.subject',
18
- count: documents.length,
19
- title: Array(title).first)
5
+ helper CatalogHelper
6
+ helper_method :blacklight_config, :blacklight_configuration_context
20
7
 
8
+ def email_record(documents, details, url_gen_params)
21
9
  @documents = documents
22
10
  @message = details[:message]
23
11
  @config = details[:config]
24
12
  @url_gen_params = url_gen_params
25
13
 
14
+ title = view_context.document_presenter(documents.first).html_title || I18n.t('blacklight.email.text.default_title')
15
+
16
+ subject = I18n.t('blacklight.email.text.subject',
17
+ count: documents.length,
18
+ title: Array(title).first)
19
+
26
20
  mail(to: details[:to], subject: subject)
27
21
  end
28
22
 
@@ -33,4 +27,14 @@ class RecordMailer < ApplicationMailer
33
27
 
34
28
  mail(to: details[:to], subject: "") # rubocop:disable Rails/I18nLocaleTexts
35
29
  end
30
+
31
+ def blacklight_config
32
+ @config || Blacklight.default_configuration
33
+ end
34
+
35
+ ##
36
+ # Context in which to evaluate blacklight configuration conditionals
37
+ def blacklight_configuration_context
38
+ @blacklight_configuration_context ||= Blacklight::Configuration::Context.new(self)
39
+ end
36
40
  end
@@ -11,18 +11,20 @@ module Blacklight
11
11
  # @param [SolrDocument] document
12
12
  # @param [ActionView::Base] view_context scope for linking and generating urls
13
13
  # @param [Blacklight::Configuration] configuration
14
- def initialize(document, view_context, configuration = view_context.blacklight_config)
14
+ def initialize(document, view_context, configuration = view_context.blacklight_config, view_config: nil, field_presenter_options: {})
15
15
  @document = document
16
16
  @view_context = view_context
17
17
  @configuration = configuration
18
+ @view_config = view_config
19
+ @field_presenter_options = field_presenter_options
18
20
  end
19
21
 
20
22
  # @return [Hash<String,Configuration::Field>] all the fields for this index view that should be rendered
21
- def fields_to_render
22
- return to_enum(:fields_to_render) unless block_given?
23
+ def fields_to_render(document_fields = fields, **kwargs)
24
+ return to_enum(:fields_to_render, document_fields, **kwargs) unless block_given?
23
25
 
24
- fields.each do |name, field_config|
25
- field_presenter = field_presenter(field_config)
26
+ document_fields.each do |name, field_config|
27
+ field_presenter = field_presenter(field_config, kwargs)
26
28
 
27
29
  next unless field_presenter.render_field? && field_presenter.any?
28
30
 
@@ -30,10 +32,10 @@ module Blacklight
30
32
  end
31
33
  end
32
34
 
33
- def field_presenters
34
- return to_enum(:field_presenters) unless block_given?
35
+ def field_presenters(document_fields = fields, **kwargs)
36
+ return to_enum(:field_presenters, document_fields, **kwargs) unless block_given?
35
37
 
36
- fields_to_render.each { |_, _, config| yield config }
38
+ fields_to_render(document_fields, **kwargs).each { |_, _, config| yield config }
37
39
  end
38
40
 
39
41
  ##
@@ -116,11 +118,11 @@ module Blacklight
116
118
  end
117
119
 
118
120
  def view_config
119
- show_view_config
121
+ @view_config ||= show_view_config
120
122
  end
121
123
 
122
124
  def show_view_config
123
- configuration.view_config(:show)
125
+ configuration.view_config(:show, action_name: view_context.action_name)
124
126
  end
125
127
 
126
128
  def inspect
@@ -150,7 +152,7 @@ module Blacklight
150
152
  end
151
153
 
152
154
  def field_presenter_options
153
- {}
155
+ @field_presenter_options ||= {}
154
156
  end
155
157
  end
156
158
  end
@@ -3,7 +3,7 @@
3
3
  module Blacklight
4
4
  class IndexPresenter < DocumentPresenter
5
5
  def view_config
6
- configuration.view_config(view_context.document_index_view_type)
6
+ @view_config ||= configuration.view_config(view_context.document_index_view_type, action_name: view_context.action_name)
7
7
  end
8
8
  end
9
9
  end
@@ -20,6 +20,10 @@ module Blacklight
20
20
  first, *rest = *stack
21
21
  first.new(output_values, config, document, context, options, rest).render
22
22
  end
23
+
24
+ def html?
25
+ options[:format].nil? || options[:format].to_s == 'html'
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -5,7 +5,13 @@ module Blacklight
5
5
  class Join < AbstractStep
6
6
  def render
7
7
  options = config.separator_options || {}
8
- next_step(values.map { |x| x.html_safe? ? x : html_escape(x) }.to_sentence(options).html_safe)
8
+ if values.one? || values.none?
9
+ next_step(values.first)
10
+ elsif !html?
11
+ next_step(values.to_sentence(options))
12
+ else
13
+ next_step(values.map { |x| x.html_safe? ? x : html_escape(x) }.to_sentence(options).html_safe)
14
+ end
9
15
  end
10
16
 
11
17
  private
@@ -4,7 +4,7 @@ module Blacklight
4
4
  module Rendering
5
5
  class LinkToFacet < AbstractStep
6
6
  def render
7
- return next_step(values) unless config.link_to_facet
7
+ return next_step(values) unless config.link_to_facet && html?
8
8
 
9
9
  next_step(render_link)
10
10
  end
@@ -5,7 +5,7 @@ module Blacklight
5
5
  class Microdata < AbstractStep
6
6
  include ActionView::Helpers::TagHelper
7
7
  def render
8
- return next_step(values) unless config.itemprop
8
+ return next_step(values) unless config.itemprop && html?
9
9
 
10
10
  next_step(values.map { |x| itemprop(x, config.itemprop) })
11
11
  end
@@ -44,7 +44,8 @@ module Blacklight
44
44
 
45
45
  # retrieve a document, given the doc id
46
46
  # @param [Array{#to_s},#to_s] id
47
- # @return [Blacklight::SolrDocument] the solr response object and the first document
47
+ # @return [Blacklight::SolrDocument] the solr document (or array of
48
+ # documents if an array of ids was given)
48
49
  def fetch(id = nil, extra_controller_params = {})
49
50
  if id.is_a? Array
50
51
  fetch_many(id, extra_controller_params)
@@ -21,7 +21,7 @@ xml.entry do
21
21
  with_format(:html) do
22
22
  xml.summary "type" => "html" do
23
23
  document_component = blacklight_config.view_config(:atom).summary_component
24
- xml.text! render document_component.new(presenter: document_presenter(document), component: :div, show: true)
24
+ xml.text! render document_component.new(document_component.collection_parameter => document_presenter(document), component: :div, show: true)
25
25
  end
26
26
  end
27
27
 
@@ -1,9 +1,4 @@
1
1
  <% # container for a single doc -%>
2
- <% view_config = local_assigns[:view_config] || blacklight_config.view_config(document_index_view_type) %>
3
- <%= render view_config.document_component.new(presenter: document_presenter(document), counter: document_counter_with_offset(document_counter)) do |component| %>
4
- <% view_config.partials.each do |partial| %>
5
- <% component.with_partial do %>
6
- <%= render_document_partial document, partial, component: component, document_counter: document_counter %>
7
- <% end %>
8
- <% end %>
9
- <% end %>
2
+ <% view_config = local_assigns[:view_config] || blacklight_config.view_config(document_index_view_type, action_name: action_name) %>
3
+ <% document_component = view_config.document_component -%>
4
+ <%= render document_component.new(document_component.collection_parameter => document_presenter(document), counter: document_counter_with_offset(document_counter), partials: view_config&.partials) %>
@@ -1,5 +1,6 @@
1
1
  <% # container for all documents in index list view -%>
2
2
  <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
3
3
  <div id="documents" class="documents-<%= view_config&.key || document_index_view_type %>">
4
- <%= render documents, as: :document, view_config: view_config %>
4
+ <% document_presenters = documents.map { |doc| document_presenter(doc) } -%>
5
+ <%= render view_config.document_component.with_collection(document_presenters, partials: view_config.partials, counter_offset: @response&.start || 0) %>
5
6
  </div>
@@ -1,9 +1,9 @@
1
- <%= render(Blacklight::SearchContextComponent.new(search_context: @search_context, search_session: search_session)) if search_session['document_id'] == @document.id %>
2
-
1
+ <%= render blacklight_config.track_search_session.item_pagination_component.new(search_context: @search_context, search_session: search_session, current_document: @document) if blacklight_config.track_search_session.item_pagination_component %>
3
2
  <% @page_title = t('blacklight.search.show.title', document_title: document_presenter(@document).html_title, application_name: application_name).html_safe %>
4
3
  <% content_for(:head) { render_link_rel_alternates } %>
5
4
 
6
- <%= render (blacklight_config.view_config(:show).document_component).new(presenter: document_presenter(@document), component: :div, show: true) do |component| %>
5
+ <% document_component = blacklight_config.view_config(:show).document_component -%>
6
+ <%= render (document_component).new(document_component.collection_parameter => document_presenter(@document), component: :div, show: true, partials: blacklight_config.view_config(:show).partials) do |component| %>
7
7
  <% component.with_title(as: 'h1', classes: '', link_to_document: false, actions: false) %>
8
8
  <% component.with_footer do %>
9
9
  <% if @document.respond_to?(:export_as_openurl_ctx_kev) %>
@@ -11,10 +11,4 @@
11
11
  <span class="Z3988" title="<%= @document.export_as_openurl_ctx_kev(document_presenter(@document).display_type) %>"></span>
12
12
  <% end %>
13
13
  <% end %>
14
-
15
- <% blacklight_config.view_config(:show).partials.each do |partial| %>
16
- <% component.with_partial do %>
17
- <%= render_document_partial @document, partial, component: component %>
18
- <% end %>
19
- <% end %>
20
14
  <% end %>
@@ -1,3 +1,6 @@
1
+ <% content_for(:head) do %>
2
+ <meta name="blacklight-search-storage" content="<%= blacklight_config.track_search_session.storage %>">
3
+ <% end %>
1
4
  <% content_for(:sidebar) do %>
2
5
  <% conf = blacklight_config.view_config(document_index_view_type) %>
3
6
  <%= render conf.sidebar_component.new(blacklight_config: blacklight_config,
@@ -1,9 +1,4 @@
1
- <% if current_search_session %>
2
- <div id="appliedParams" class="clearfix constraints-container">
3
- <%= render 'start_over' %>
4
- <%= link_back_to_catalog class: 'btn btn-outline-secondary' %>
5
- </div>
6
- <% end %>
1
+ <%= render blacklight_config.track_search_session.applied_params_component.new if blacklight_config.track_search_session.applied_params_component %>
7
2
 
8
3
  <%= render 'show_main_content' %>
9
4
 
@@ -19,16 +19,16 @@
19
19
  <%= javascript_importmap_tags %>
20
20
  <% elsif defined? Propshaft %>
21
21
  <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
22
- <% else %>
22
+ <% else %>
23
23
  <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
24
24
  <%= javascript_include_tag "blacklight/blacklight", type: 'module' %>
25
+ <script type="module">
26
+ import githubAutoCompleteElement from 'https://cdn.skypack.dev/@github/auto-complete-element';
27
+ </script>
25
28
  <% end %>
26
29
 
27
30
  <%= csrf_meta_tags %>
28
31
  <%= content_for(:head) %>
29
- <script type="module">
30
- import githubAutoCompleteElement from 'https://cdn.skypack.dev/@github/auto-complete-element';
31
- </script>
32
32
  </head>
33
33
  <body class="<%= render_body_class %>">
34
34
  <nav id="skip-link" role="navigation" aria-label="<%= t('blacklight.skip_links.label') %>">
@@ -1,6 +1,7 @@
1
+ <%= t('blacklight.email.text.message', message: @message) %>
2
+
1
3
  <% @documents.each do |document| %>
2
- <%= document.to_email_text %>
3
- <%= t('blacklight.email.text.url', :url =>polymorphic_url(document, @url_gen_params)) %>
4
+ <%= render Blacklight::DocumentMetadataComponent.new(fields: document_presenter(document).field_presenters(blacklight_config.email_fields), tag: nil, field_layout: Blacklight::MetadataFieldPlainTextLayoutComponent, field_presenter_options: { format: 'text' }) %>
4
5
 
6
+ <%= t('blacklight.email.text.url', url: polymorphic_url(document, @url_gen_params)) %>
5
7
  <% end %>
6
- <%= t('blacklight.email.text.message', :message => @message) %>
@@ -1,4 +1,4 @@
1
- <% @documents.each do |document| %>
2
- <%= document.to_sms_text(@config) %>
3
- <%= t('blacklight.sms.text.url', :url => polymorphic_url(document, @url_gen_params) ) %>
4
- <% end %>
1
+ <% @documents.each do |document| %>
2
+ <%= render Blacklight::DocumentMetadataComponent.new(fields: document_presenter(document).field_presenters(blacklight_config.sms_fields), tag: nil, field_layout: Blacklight::MetadataFieldPlainTextLayoutComponent, field_presenter_options: { format: 'text' }) %>
3
+ <%= t('blacklight.sms.text.url', url: polymorphic_url(document, @url_gen_params)) %>
4
+ <% end %>
data/blacklight.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  full text and/or metadata.)
18
18
  s.license = "Apache 2.0"
19
19
 
20
- s.files = `git ls-files -z`.split("\x0")
20
+ s.files = `git ls-files -z`.split("\x0") + Dir.glob("app/assets/javascript/blacklight/**/*")
21
21
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
22
22
  s.bindir = 'exe'
23
23
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
data/config/importmap.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- pin_all_from File.expand_path("../app/javascript/blacklight", __dir__)
3
+ pin_all_from File.expand_path("../app/javascript/blacklight", __dir__), under: "blacklight"