blacklight 7.11.1 → 7.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -0
  3. data/.solr_wrapper.yml +5 -0
  4. data/VERSION +1 -1
  5. data/app/builders/blacklight/action_builder.rb +6 -0
  6. data/app/components/blacklight/constraint_component.html.erb +5 -0
  7. data/app/components/blacklight/constraint_component.rb +13 -0
  8. data/app/components/blacklight/constraint_layout_component.rb +2 -1
  9. data/app/components/blacklight/constraints_component.html.erb +10 -0
  10. data/app/components/blacklight/constraints_component.rb +65 -0
  11. data/app/components/blacklight/document/action_component.html.erb +9 -0
  12. data/app/components/blacklight/document/action_component.rb +38 -0
  13. data/app/components/blacklight/document/actions_component.html.erb +13 -0
  14. data/app/components/blacklight/document/actions_component.rb +26 -0
  15. data/app/components/blacklight/document/bookmark_component.html.erb +1 -1
  16. data/app/components/blacklight/document/bookmark_component.rb +8 -0
  17. data/app/components/blacklight/document/citation_component.html.erb +4 -2
  18. data/app/components/blacklight/document/citation_component.rb +8 -1
  19. data/app/components/blacklight/document/group_component.html.erb +9 -0
  20. data/app/components/blacklight/document/group_component.rb +26 -0
  21. data/app/components/blacklight/document/more_like_this_component.rb +2 -0
  22. data/app/components/blacklight/document/thumbnail_component.html.erb +12 -0
  23. data/app/components/blacklight/document/thumbnail_component.rb +25 -0
  24. data/app/components/blacklight/document_component.rb +27 -26
  25. data/app/components/blacklight/facet_field_filter_component.html.erb +12 -0
  26. data/app/components/blacklight/facet_field_filter_component.rb +25 -0
  27. data/app/components/blacklight/facet_field_pagination_component.html.erb +19 -0
  28. data/app/components/blacklight/facet_field_pagination_component.rb +21 -0
  29. data/app/components/blacklight/facet_item_component.rb +4 -8
  30. data/app/components/blacklight/response/facet_group_component.html.erb +3 -1
  31. data/app/components/blacklight/response/facet_group_component.rb +8 -1
  32. data/app/components/blacklight/response/pagination_component.rb +3 -0
  33. data/app/components/blacklight/response/sort_component.html.erb +1 -1
  34. data/app/components/blacklight/response/spellcheck_component.rb +9 -2
  35. data/app/components/blacklight/response/view_type_component.html.erb +11 -0
  36. data/app/components/blacklight/response/view_type_component.rb +36 -0
  37. data/app/components/blacklight/search_bar_component.html.erb +1 -1
  38. data/app/components/blacklight/search_bar_component.rb +6 -0
  39. data/app/components/blacklight/search_context_component.rb +6 -2
  40. data/app/components/blacklight/system/dropdown_component.html.erb +1 -1
  41. data/app/components/blacklight/system/flash_message_component.html.erb +4 -0
  42. data/app/components/blacklight/system/flash_message_component.rb +24 -0
  43. data/app/controllers/concerns/blacklight/catalog.rb +7 -1
  44. data/app/controllers/concerns/blacklight/controller.rb +12 -3
  45. data/app/controllers/concerns/blacklight/facet.rb +19 -5
  46. data/app/controllers/concerns/blacklight/search_fields.rb +7 -1
  47. data/app/helpers/blacklight/blacklight_helper_behavior.rb +127 -17
  48. data/app/helpers/blacklight/catalog_helper_behavior.rb +36 -5
  49. data/app/helpers/blacklight/component_helper_behavior.rb +36 -6
  50. data/app/helpers/blacklight/configuration_helper_behavior.rb +32 -4
  51. data/app/helpers/blacklight/facets_helper_behavior.rb +31 -8
  52. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +5 -0
  53. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +28 -11
  54. data/app/helpers/blacklight/render_partials_helper_behavior.rb +8 -3
  55. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +4 -2
  56. data/app/helpers/blacklight/suggest_helper_behavior.rb +1 -0
  57. data/app/helpers/blacklight/url_helper_behavior.rb +23 -3
  58. data/app/models/blacklight/icon.rb +0 -1
  59. data/app/models/concerns/blacklight/document.rb +1 -1
  60. data/app/models/concerns/blacklight/suggest/response.rb +1 -1
  61. data/app/models/record_mailer.rb +1 -1
  62. data/app/presenters/blacklight/document_presenter.rb +42 -1
  63. data/app/presenters/blacklight/facet_field_presenter.rb +3 -1
  64. data/app/presenters/blacklight/facet_item_presenter.rb +8 -0
  65. data/app/presenters/blacklight/field_presenter.rb +9 -6
  66. data/app/presenters/blacklight/json_presenter.rb +3 -1
  67. data/app/presenters/blacklight/show_presenter.rb +4 -30
  68. data/app/presenters/blacklight/thumbnail_presenter.rb +5 -1
  69. data/app/services/blacklight/document_factory.rb +3 -0
  70. data/app/services/blacklight/field_retriever.rb +18 -4
  71. data/app/services/blacklight/search_service.rb +0 -1
  72. data/app/views/bookmarks/_tools.html.erb +12 -7
  73. data/app/views/catalog/_bookmark_control.html.erb +1 -1
  74. data/app/views/catalog/_constraints.html.erb +12 -7
  75. data/app/views/catalog/_document.atom.builder +9 -6
  76. data/app/views/catalog/_document.rss.builder +4 -2
  77. data/app/views/catalog/_facet_index_navigation.html.erb +1 -10
  78. data/app/views/catalog/_facet_pagination.html.erb +1 -19
  79. data/app/views/catalog/_facets.html.erb +1 -1
  80. data/app/views/catalog/_group.html.erb +1 -9
  81. data/app/views/catalog/_index.html.erb +1 -1
  82. data/app/views/catalog/_search_results.html.erb +1 -1
  83. data/app/views/catalog/_show.html.erb +1 -1
  84. data/app/views/catalog/_show_header.html.erb +1 -1
  85. data/app/views/catalog/_show_main_content.html.erb +2 -2
  86. data/app/views/catalog/_show_tools.html.erb +12 -8
  87. data/app/views/catalog/_start_over.html.erb +1 -1
  88. data/app/views/catalog/_thumbnail.html.erb +1 -5
  89. data/app/views/catalog/_view_type_group.html.erb +5 -13
  90. data/app/views/catalog/index.json.jbuilder +8 -6
  91. data/app/views/catalog/show.json.jbuilder +1 -1
  92. data/app/views/shared/_flash_msg.html.erb +1 -15
  93. data/blacklight.gemspec +1 -0
  94. data/config/locales/blacklight.ca.yml +241 -0
  95. data/lib/blacklight/abstract_repository.rb +13 -4
  96. data/lib/blacklight/configuration.rb +11 -5
  97. data/lib/blacklight/configuration/display_field.rb +50 -0
  98. data/lib/blacklight/configuration/facet_field.rb +58 -1
  99. data/lib/blacklight/configuration/field.rb +13 -0
  100. data/lib/blacklight/configuration/index_field.rb +5 -0
  101. data/lib/blacklight/configuration/search_field.rb +3 -0
  102. data/lib/blacklight/configuration/show_field.rb +5 -0
  103. data/lib/blacklight/configuration/sort_field.rb +3 -0
  104. data/lib/blacklight/configuration/tool_config.rb +1 -0
  105. data/lib/blacklight/configuration/view_config.rb +25 -0
  106. data/lib/blacklight/search_state.rb +4 -2
  107. data/lib/blacklight/solr/repository.rb +1 -1
  108. data/lib/generators/blacklight/templates/catalog_controller.rb +8 -7
  109. data/spec/components/blacklight/document/action_component_spec.rb +43 -0
  110. data/spec/components/blacklight/document/group_component_spec.rb +45 -0
  111. data/spec/components/blacklight/document_component_spec.rb +8 -0
  112. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +0 -1
  113. data/spec/components/blacklight/system/flash_message_component_spec.rb +54 -0
  114. data/spec/controllers/blacklight/search_fields_spec.rb +2 -0
  115. data/spec/controllers/catalog_controller_spec.rb +2 -0
  116. data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +6 -1
  117. data/spec/helpers/blacklight/hash_as_hidden_fields_behavior_spec.rb +2 -0
  118. data/spec/helpers/blacklight/render_constraints_helper_behavior_spec.rb +2 -0
  119. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +3 -1
  120. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +2 -0
  121. data/spec/helpers/blacklight_helper_spec.rb +10 -0
  122. data/spec/helpers/catalog_helper_spec.rb +4 -4
  123. data/spec/lib/blacklight/configuration/facet_field_spec.rb +17 -0
  124. data/spec/models/blacklight/search_builder_spec.rb +1 -1
  125. data/spec/models/blacklight/solr/search_builder_spec.rb +8 -0
  126. data/spec/presenters/blacklight/field_presenter_spec.rb +30 -5
  127. data/spec/services/blacklight/search_service_spec.rb +1 -5
  128. data/spec/views/catalog/_constraints.html.erb_spec.rb +2 -1
  129. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +4 -2
  130. data/spec/views/catalog/_show_tools.html.erb_spec.rb +8 -8
  131. data/spec/views/catalog/show.json.jbuilder_spec.rb +1 -0
  132. data/tasks/blacklight.rake +27 -12
  133. metadata +47 -2
@@ -14,6 +14,10 @@ module Blacklight
14
14
  @view_config = view_config
15
15
  end
16
16
 
17
+ def render(image_options = {})
18
+ thumbnail_value(image_options)
19
+ end
20
+
17
21
  ##
18
22
  # Does the document have a thumbnail to render?
19
23
  #
@@ -72,7 +76,7 @@ module Blacklight
72
76
  end
73
77
 
74
78
  def retrieve_values(field_config)
75
- FieldRetriever.new(document, field_config).fetch
79
+ FieldRetriever.new(document, field_config, view_context).fetch
76
80
  end
77
81
 
78
82
  def field_config(field)
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Blacklight
4
+ # A class that create documents from repository results
4
5
  class DocumentFactory
6
+ # @return [Blacklight::Document]
5
7
  def self.build(data, response, options)
6
8
  document_model(data, options).new(data, response)
7
9
  end
8
10
 
11
+ # @return [Blacklight::Document]
9
12
  def self.document_model(_data, options)
10
13
  options[:solr_document_model] || options[:document_model] || SolrDocument
11
14
  end
@@ -2,14 +2,21 @@
2
2
 
3
3
  module Blacklight
4
4
  class FieldRetriever
5
- # @param [SolrDocument] document
5
+ # @param [Blacklight::Document] document
6
6
  # @param [Blacklight::Configuration::Field] field_config solr field configuration
7
- def initialize(document, field_config)
7
+ # @param [ActionView::Base] Rails rendering context
8
+ def initialize(document, field_config, view_context = nil)
8
9
  @document = document
9
10
  @field_config = field_config
11
+ @view_context = view_context
10
12
  end
11
13
 
12
- attr_reader :document, :field_config
14
+ # @return [Blacklight::Document]
15
+ attr_reader :document
16
+ # @return [Blacklight::Configuration::Field]
17
+ attr_reader :field_config
18
+ # @return [ActionView::Base]
19
+ attr_reader :view_context
13
20
 
14
21
  delegate :field, to: :field_config
15
22
 
@@ -60,7 +67,14 @@ module Blacklight
60
67
  end
61
68
 
62
69
  def retrieve_values
63
- field_config.values.call(field_config, document)
70
+ values_method = field_config.values
71
+
72
+ if values_method.respond_to?(:arity) && values_method.arity.abs == 2
73
+ Deprecation.warn(self, ":values parameter for field #{field_config.key} only accepts 2 arguments; should accept 3")
74
+ values_method.call(field_config, document)
75
+ else
76
+ values_method.call(field_config, document, view_context)
77
+ end
64
78
  end
65
79
  end
66
80
  end
@@ -17,7 +17,6 @@ module Blacklight
17
17
  end
18
18
 
19
19
  # a solr query method
20
- # @param [Hash] user_params ({}) the user provided parameters (e.g. query, facets, sort, etc)
21
20
  # @yield [search_builder] optional block yields configured SearchBuilder, caller can modify or create new SearchBuilder to be used. Block should return SearchBuilder to be used.
22
21
  # @return [Blacklight::Solr::Response] the solr response object
23
22
  def search_results
@@ -1,7 +1,12 @@
1
- <ul class="<%= controller_name %>Tools nav nav-pills">
2
- <%= render_show_doc_actions document_list, document: nil, document_list: @response.documents, url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h) do |config, inner| %>
3
- <li class="nav-item">
4
- <%= inner %>
5
- </li>
6
- <% end %>
7
- </ul>
1
+ <% if render_show_doc_actions_method_from_blacklight? %>
2
+ <%= render(Blacklight::Document::ActionsComponent.new(document: nil, tag: 'ul', classes: "#{controller_name}Tools nav nav-pills", wrapping_tag: 'li', wrapping_classes: 'nav-item', actions: document_actions(document_list), options: { document_list: @response.documents }, url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h))) %>
3
+ <% else %>
4
+ <% Deprecation.warn(self, '#render_show_doc_actions is deprecated; use ActionComponents instead') %>
5
+ <ul class="<%= controller_name %>Tools nav nav-pills">
6
+ <%= render_show_doc_actions document_list, document: nil, document_list: @response.documents, url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h) do |config, inner| %>
7
+ <li class="nav-item">
8
+ <%= inner %>
9
+ </li>
10
+ <% end %>
11
+ </ul>
12
+ <% end %>
@@ -1 +1 @@
1
- <%= render Blacklight::Document::BookmarkComponent.new(document: document, bookmark_path: bookmark_path(document)) if current_or_guest_user %>
1
+ <%= render Blacklight::Document::BookmarkComponent.new(document: document) if current_or_guest_user %>
@@ -1,9 +1,14 @@
1
- <% if Deprecation.silence(Blacklight::RenderConstraintsHelperBehavior) { query_has_constraints? } %>
2
- <div id="appliedParams" class="clearfix constraints-container">
3
- <h2 class="sr-only"><%= t('blacklight.search.search_constraints_header') %></h2>
1
+ <% if constraints_helpers_and_partials_from_blacklight? %>
2
+ <%= render(Blacklight::ConstraintsComponent.new(search_state: convert_to_search_state(controller.params != params ? params : search_state))) %>
3
+ <% else %>
4
+ <% Deprecation.warn(Blacklight::RenderConstraintsHelperBehavior, 'Constraints helpers or partials were overridden; not using components') %>
5
+ <% if Deprecation.silence(Blacklight::RenderConstraintsHelperBehavior) { query_has_constraints? } %>
6
+ <div id="appliedParams" class="clearfix constraints-container">
7
+ <h2 class="sr-only"><%= t('blacklight.search.search_constraints_header') %></h2>
4
8
 
5
- <%= render 'start_over' %>
6
- <span class="constraints-label sr-only"><%= t('blacklight.search.filters.title') %></span>
7
- <%= render_constraints(controller.params != params ? params : search_state) %>
8
- </div>
9
+ <%= render 'start_over' %>
10
+ <span class="constraints-label sr-only"><%= t('blacklight.search.filters.title') %></span>
11
+ <%= render_constraints(controller.params != params ? params : search_state) %>
12
+ </div>
13
+ <% end %>
9
14
  <% end %>
@@ -1,17 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ presenter = document_presenter(document)
3
4
  xml.entry do
4
- xml.title index_presenter(document).heading
5
+ xml.title presenter.heading
5
6
 
6
7
  # updated is required, for now we'll just set it to now, sorry
7
8
  xml.updated Time.current.iso8601
8
9
 
9
- xml.link "rel" => "alternate", "type" => "text/html", "href" => polymorphic_url(url_for_document(document))
10
- # add other doc-specific formats, atom only lets us have one per
11
- # content type, so the first one in the list wins.
12
- xml << show_presenter(document).link_rel_alternates(unique: true)
10
+ Deprecation.silence(Blacklight::UrlHelperBehavior) do
11
+ xml.link "rel" => "alternate", "type" => "text/html", "href" => polymorphic_url(url_for_document(document))
12
+ # add other doc-specific formats, atom only lets us have one per
13
+ # content type, so the first one in the list wins.
14
+ xml << presenter.link_rel_alternates(unique: true)
13
15
 
14
- xml.id polymorphic_url(url_for_document(document))
16
+ xml.id polymorphic_url(url_for_document(document))
17
+ end
15
18
 
16
19
  if document.to_semantic_values.key? :author
17
20
  xml.author { xml.name(document.to_semantic_values[:author].first) }
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  xml.item do
4
- xml.title(index_presenter(document).heading || (document.to_semantic_values[:title].first if document.to_semantic_values.key?(:title)))
5
- xml.link(polymorphic_url(url_for_document(document)))
4
+ xml.title(document_presenter(document).heading || (document.to_semantic_values[:title].first if document.to_semantic_values.key?(:title)))
5
+ Deprecation.silence(Blacklight::UrlHelperBehavior) do
6
+ xml.link(polymorphic_url(url_for_document(document)))
7
+ end
6
8
  xml.author( document.to_semantic_values[:author].first ) if document.to_semantic_values.key? :author
7
9
  end
@@ -1,10 +1 @@
1
- <nav class="alpha-filter">
2
- <ol class="pagination pagination-sm justify-content-center">
3
- <li class="page-item <%= 'active' if @pagination.prefix.blank? %>">
4
- <%= link_to t('blacklight.search.facets.all'), @pagination.params_for_resort_url('index', search_state.to_h.except(@pagination.request_keys[:prefix])), data: { blacklight_modal: "preserve" }, class: 'page-link' %>
5
- </li>
6
- <% @facet.index_range.each do |letter| %>
7
- <li class="page-item <%= 'active' if @pagination.prefix == letter %>"><%= link_to(letter, @pagination.params_for_resort_url('index', search_state.to_h.merge(@pagination.request_keys[:prefix] => letter)), class: 'page-link', data: { blacklight_modal: "preserve" }) %></li>
8
- <% end %>
9
- </ol>
10
- </nav>
1
+ <%= render(Blacklight::FacetFieldFilterComponent.new(facet_field: facet_field_presenter(@facet, @display_facet))) %>
@@ -1,19 +1 @@
1
- <div class="prev_next_links btn-group">
2
- <%= link_to_previous_page @pagination, raw(t('views.pagination.previous')), params: search_state.to_h, param_name: blacklight_config.facet_paginator_class.request_keys[:page], class: 'btn btn-link', data: { blacklight_modal: "preserve" } do %>
3
- <%= content_tag :span, raw(t('views.pagination.previous')), class: 'disabled btn' %>
4
- <% end %>
5
-
6
- <%= link_to_next_page @pagination, raw(t('views.pagination.next')), params: search_state.to_h, param_name: blacklight_config.facet_paginator_class.request_keys[:page], class: 'btn btn-link', data: { blacklight_modal: "preserve" } do %>
7
- <%= content_tag :span, raw(t('views.pagination.next')), class: 'disabled btn' %>
8
- <% end %>
9
- </div>
10
-
11
- <div class="sort-options btn-group">
12
- <% if @pagination.sort == 'index' -%>
13
- <span class="active az btn btn-outline-secondary"><%= t('blacklight.search.facets.sort.index') %></span>
14
- <%= link_to(t('blacklight.search.facets.sort.count'), @pagination.params_for_resort_url('count', search_state.to_h), class: "sort_change numeric btn btn-outline-secondary", data: { blacklight_modal: "preserve" }) %>
15
- <% elsif @pagination.sort == 'count' -%>
16
- <%= link_to(t('blacklight.search.facets.sort.index'), @pagination.params_for_resort_url('index', search_state.to_h), class: "sort_change az btn btn-outline-secondary", data: { blacklight_modal: "preserve" }) %>
17
- <span class="active numeric btn btn-outline-secondary"><%= t('blacklight.search.facets.sort.count') %></span>
18
- <% end -%>
19
- </div>
1
+ <%= render(Blacklight::FacetFieldPaginationComponent.new(facet_field: facet_field_presenter(@facet, @display_facet))) %>
@@ -1,4 +1,4 @@
1
1
  <% # container for facet groups -%>
2
- <% facet_group_names.each do |groupname| %>
2
+ <% Deprecation.silence(Blacklight::Facet) { facet_group_names }.each do |groupname| %>
3
3
  <%= render 'facet_group', groupname: groupname %>
4
4
  <% end %>
@@ -1,12 +1,4 @@
1
1
  <% # container for all groups in index view -%>
2
2
  <div id="groups">
3
- <%- @response.groups.each do |g| %>
4
- <h2 class="group-key"><%= g.key %></h2>
5
- <div class="grouped-documents">
6
- <%= render_document_index g.docs %>
7
- </div>
8
- <%- if g.total > @response.group_limit %>
9
- <%= link_to t('blacklight.search.group.more'), add_group_facet_params_and_redirect(g), :class => 'more-in-group' %>
10
- <%- end %>
11
- <%- end %>
3
+ <%= render(Blacklight::Document::GroupComponent.with_collection(g, group_limit: @response.group_limit)) %>
12
4
  </div>
@@ -1 +1 @@
1
- <%= render(Blacklight::DocumentMetadataComponent.new(fields: index_presenter(document).field_presenters)) %>
1
+ <%= render(Blacklight::DocumentMetadataComponent.new(fields: document_presenter(document).field_presenters)) %>
@@ -24,7 +24,7 @@
24
24
  <%- if @response.empty? %>
25
25
  <%= render "zero_results" %>
26
26
  <%- elsif render_grouped_response? %>
27
- <%= render_grouped_document_index %>
27
+ <%= Deprecation.silence(Blacklight::RenderPartialsHelperBehavior) { render_grouped_document_index } %>
28
28
  <%- else %>
29
29
  <%= render_document_index %>
30
30
  <%- end %>
@@ -1,6 +1,6 @@
1
1
  <%= render(
2
2
  Blacklight::DocumentMetadataComponent.new(
3
- fields: show_presenter(document).field_presenters,
3
+ fields: document_presenter(document).field_presenters,
4
4
  show: true
5
5
  )
6
6
  ) %>
@@ -1,2 +1,2 @@
1
1
  <% # bookmark/folder functions -%>
2
- <%= render_document_heading(document, :tag => :h1) %>
2
+ <%= Deprecation.silence(Blacklight::BlacklightHelperBehavior) { render_document_heading(document, :tag => :h1) } %>
@@ -1,6 +1,6 @@
1
1
  <%= render 'previous_next_doc' if @search_context && search_session['document_id'] == @document.id %>
2
2
 
3
- <% @page_title = t('blacklight.search.show.title', :document_title => document_show_html_title, :application_name => application_name).html_safe %>
3
+ <% @page_title = t('blacklight.search.show.title', document_title: Deprecation.silence(Blacklight::BlacklightHelperBehavior) { document_show_html_title }, application_name: application_name).html_safe %>
4
4
  <% content_for(:head) { render_link_rel_alternates } %>
5
5
 
6
6
  <%= render (blacklight_config.show.document_component || Blacklight::DocumentComponent).new(document: @document, component: :div, title_component: :h1, show: true) do |component| %>
@@ -11,7 +11,7 @@
11
11
  // This document_partial_name(@document) business is not quite right,
12
12
  // but has been there for a while.
13
13
  -->
14
- <span class="Z3988" title="<%= @document.export_as_openurl_ctx_kev(document_partial_name(@document)) %>"></span>
14
+ <span class="Z3988" title="<%= @document.export_as_openurl_ctx_kev(Deprecation.silence(Blacklight::RenderPartialsHelperBehavior) { document_partial_name(@document) }) %>"></span>
15
15
  <% end %>
16
16
  <% end %>
17
17
 
@@ -3,13 +3,17 @@
3
3
  <div class="card-header">
4
4
  <h2 class="mb-0 h6"><%= t('blacklight.tools.title') %></h2>
5
5
  </div>
6
-
7
- <ul class="list-group list-group-flush">
8
- <%= render_show_doc_actions @document do |config, inner| %>
9
- <li class="list-group-item <%= config.key %>">
10
- <%= inner %>
11
- </li>
12
- <% end %>
13
- </ul>
6
+ <% if render_show_doc_actions_method_from_blacklight? %>
7
+ <%= render(Blacklight::Document::ActionsComponent.new(document: @document, tag: 'ul', classes: 'list-group list-group-flush', wrapping_tag: 'li', wrapping_classes: 'list-group-item', actions: document_actions(@document), url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h))) %>
8
+ <% else %>
9
+ <% Deprecation.warn(self, '#render_show_doc_actions is deprecated; use ActionComponents instead') %>
10
+ <ul class="list-group list-group-flush">
11
+ <%= render_show_doc_actions @document do |config, inner| %>
12
+ <li class="list-group-item <%= config.key %>">
13
+ <%= inner %>
14
+ </li>
15
+ <% end %>
16
+ </ul>
17
+ <% end %>
14
18
  </div>
15
19
  <% end %>
@@ -1 +1 @@
1
- <%= link_to t('blacklight.search.start_over'), start_over_path, class: "catalog_startOverLink btn btn-primary" %>
1
+ <%= link_to t('blacklight.search.start_over'), (Deprecation.silence(Blacklight::UrlHelperBehavior) { start_over_path }), class: "catalog_startOverLink btn btn-primary" %>
@@ -1,5 +1 @@
1
- <% if presenter(document).thumbnail.exists? && tn = presenter(document).thumbnail.thumbnail_tag({ alt: '' }, 'aria-hidden': true, tabindex: -1, counter: document_counter_with_offset(document_counter)) %>
2
- <div class="document-thumbnail">
3
- <%= tn %>
4
- </div>
5
- <% end %>
1
+ <%= render Blacklight::Document::ThumbnailComponent.new(presenter: document_presenter(document), counter: document_counter_with_offset(document_counter)) -%>
@@ -1,13 +1,5 @@
1
- <% if show_sort_and_per_page? and has_alternative_views? -%>
2
- <div class="view-type">
3
- <span class="sr-only"><%= t('blacklight.search.view_title') %></span>
4
- <div class="view-type-group btn-group">
5
- <% document_index_view_controls.each do |view, config| %>
6
- <%= link_to url_for(search_state.to_h.merge(view: view)), title: view_label(view), class: "btn btn-outline-secondary btn-icon view-type-#{ view.to_s.parameterize } #{"active" if document_index_view_type == view}" do %>
7
- <%= render_view_type_group_icon view %>
8
- <span class="caption"><%= view_label(view) %></span>
9
- <% end %>
10
- <% end %>
11
- </div>
12
- </div>
13
- <% end -%>
1
+ <%= render(Blacklight::Response::ViewTypeComponent.new(
2
+ response: @response,
3
+ views: document_index_view_controls,
4
+ search_state: search_state,
5
+ selected: document_index_view_type)) if show_sort_and_per_page? -%>
@@ -12,8 +12,8 @@ end
12
12
 
13
13
  json.data do
14
14
  json.array! @presenter.documents do |document|
15
- doc_presenter = index_presenter(document)
16
- document_url = polymorphic_url(url_for_document(document))
15
+ doc_presenter = document_presenter(document)
16
+ document_url = Deprecation.silence(Blacklight::UrlHelperBehavior) { polymorphic_url(url_for_document(document)) }
17
17
  json.id document.id
18
18
  json.type doc_presenter.display_type.first
19
19
  json.attributes do
@@ -49,10 +49,12 @@ json.included do
49
49
  json.hits item.hits
50
50
  end
51
51
  json.links do
52
- if facet_in_params?(facet.name, item.value)
53
- json.remove search_action_path(search_state.remove_facet_params(facet.name, item.value))
54
- else
55
- json.self path_for_facet(facet.name, item.value, only_path: false)
52
+ Deprecation.silence(Blacklight::FacetsHelperBehavior) do
53
+ if facet_in_params?(facet.name, item.value)
54
+ json.remove search_action_path(search_state.remove_facet_params(facet.name, item.value))
55
+ else
56
+ json.self path_for_facet(facet.name, item.value, only_path: false)
57
+ end
56
58
  end
57
59
  end
58
60
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  document_url = polymorphic_url(@document)
4
- doc_presenter = show_presenter(@document)
4
+ doc_presenter = document_presenter(@document)
5
5
 
6
6
  json.links do
7
7
  json.self document_url
@@ -1,19 +1,5 @@
1
1
  <div class="flash_messages">
2
2
  <% [:success, :notice, :error, :alert].each do |type| %>
3
- <%- alert_class = case type
4
- when :success then "alert-success"
5
- when :notice then "alert-info"
6
- when :alert then "alert-warning"
7
- when :error then "alert-danger"
8
- else "alert-#{type}"
9
- end
10
- -%>
11
- <% if flash[type] %>
12
- <% Array(flash[type]).each do |f| %>
13
- <div class="alert <%= alert_class %>"><%= f %>
14
- <a class="close" data-dismiss="alert" href="#">&times;</a>
15
- </div>
16
- <% end %>
17
- <% end %>
3
+ <%= render(Blacklight::System::FlashMessageComponent.with_collection(Array.wrap(flash[type]), type: type)) if flash[type] %>
18
4
  <% end %>
19
5
  </div>
@@ -46,4 +46,5 @@ Gem::Specification.new do |s|
46
46
  s.add_development_dependency "rubocop-rails", '~> 2.6'
47
47
  s.add_development_dependency "rubocop-rspec", '~> 1.43'
48
48
  s.add_development_dependency "i18n-tasks"
49
+ s.add_development_dependency "solr_wrapper"
49
50
  end
@@ -0,0 +1,241 @@
1
+ ca:
2
+ views:
3
+ pagination:
4
+ first: '&laquo; Primera'
5
+ last: 'Darrera &raquo;'
6
+ previous: '&laquo; Anterior'
7
+ next: 'Següent &raquo;'
8
+ truncate: '…'
9
+ aria:
10
+ container_label: 'enllaços de paginació'
11
+ current_page: 'Pàgina actual, pàgina %{page}'
12
+ go_to_page: 'Anar a la pàgina %{page}'
13
+ go_to_previous_page: 'Anar a la pàgina anterior'
14
+ go_to_next_page: 'Anar a la pàgina següent'
15
+ go_to_first_page: 'Anar a la primera pàgina'
16
+ go_to_last_page: 'Anar a la darrera pàgina'
17
+
18
+ pagination_compact:
19
+ previous: '&laquo; Anterior'
20
+ next: 'Següent &raquo;'
21
+
22
+ blacklight:
23
+ application_name: 'Blacklight'
24
+ skip_links:
25
+ label: 'Saltar els enllaços'
26
+ main_content: 'Anar al contingut principal'
27
+ search_field: 'Anar a la cerca'
28
+ first_result: 'Anar al primer resultat'
29
+ header_links:
30
+ login: 'Identificació'
31
+ logout: 'Sortir'
32
+ bookmarks: "Adreces d'interès"
33
+ search_history: 'Històric'
34
+
35
+ welcome: 'Benvinguts!'
36
+ and: 'i'
37
+ or: 'o'
38
+
39
+ modal:
40
+ close: "Tancar"
41
+
42
+ bookmarks:
43
+ title: "Adreces d'interès"
44
+ page_title: "Adreces d'interès - %{application_name}"
45
+ no_bookmarks: "No teniu adreces d'interès"
46
+ add:
47
+ button: 'Desar'
48
+ success:
49
+ one: 'Adreça desada.'
50
+ other: 'Adreçes desades.'
51
+ failure: 'Hi ha hagut un problema desant les adreces.'
52
+ remove:
53
+ button: "Eliminar-la."
54
+ success: 'Adreça eliminada.'
55
+ failure: "Hi ha hagut un problema eliminant l'adreça"
56
+ action_confirm: 'Eliminar aquesta adreça?'
57
+ clear:
58
+ action_title: 'Esborrar les adreces'
59
+ action_confirm: 'Esborrar les vostres adreces?'
60
+ success: 'Adreces esborrades.'
61
+ failure: "Hi ha hagut un problema esborrant les adreces."
62
+ need_login: "Us heu d'identificar per gestionar i veure les vostres adreces d'interès."
63
+ list_title: "Les vostres adreces d'interès."
64
+ delete: 'Suprimir'
65
+
66
+ search_history:
67
+ clear:
68
+ action_title: "Esborrar l'històric de cerques"
69
+ action_confirm: 'Voleu esborrar el vostre històric de cerques?'
70
+ success: 'Històric de cerques esborrat.'
71
+ failure: "Hi ha hagut un problema esborrant l'històric de cerques."
72
+ title: 'Històric de cerques'
73
+ page_title: 'Històric de cerques - %{application_name}'
74
+ no_history: 'No teniu històric de cerques'
75
+ recent: 'Les vostres cerques recents'
76
+ forget: 'oblida-ho'
77
+ save: 'desa-ho'
78
+
79
+ tools:
80
+ title: 'Eines'
81
+ citation: 'Citació'
82
+ email: 'Correu'
83
+ sms: 'Enviar-ho per SMS'
84
+ clear: 'Esborrar'
85
+
86
+ citation:
87
+ mla: 'MLA'
88
+ apa: 'APA'
89
+ chicago: 'Chicago'
90
+
91
+ email:
92
+ form:
93
+ title: 'Enviar-ho per correu'
94
+ to: 'Email:'
95
+ message: 'Missage:'
96
+ submit: 'Enviar-ho'
97
+ text:
98
+ default_title: 'N/A'
99
+ title: 'Títol: %{value}'
100
+ author: 'Autor: %{value}'
101
+ format: 'Format: %{value}'
102
+ language: 'Llengua: %{value}'
103
+ subject:
104
+ one: 'Registre: %{title}'
105
+ other: 'Registres'
106
+ url: 'URL: %{url}'
107
+ message: 'Missage: %{message}'
108
+
109
+ success: "Correu enviat"
110
+
111
+ errors:
112
+ to:
113
+ invalid: "Heu d'entrar una adreça de correu vàlida"
114
+ blank: "Heu d'entrar un destinatari per poder enviar aquest missatge"
115
+ sms:
116
+ form:
117
+ title: 'Enviar-ho per SMS'
118
+ to: 'Número de mòbil:'
119
+ carrier: 'Operador'
120
+ carrier_prompt: 'Heu de seleccionar un operador'
121
+ submit: 'Enviar'
122
+ text:
123
+ title: '%{value}'
124
+ author: ' de %{value}'
125
+ url: 'URL: %{url}'
126
+ success: "SMS enviat"
127
+ errors:
128
+ to:
129
+ invalid: "Heu d'entrar un número de mòbil correcte, de 10 xifres"
130
+ blank: "Heu d'entrar un número de mòbil per poder enviar aquest missatge"
131
+ carrier:
132
+ blank: 'Heu de seleccionar un operador'
133
+ invalid: 'Heu de seleccionar-ne un de correcte'
134
+
135
+ back_to_search: 'Tornar als resultats'
136
+ back_to_bookmarks: "Tornar a les adreces d'interès"
137
+
138
+ search:
139
+ page_title:
140
+ title: '%{constraints} - %{application_name} Resultats de la cerca'
141
+ constraint: '%{label}: %{value}'
142
+ many_constraint_values: '%{values} seleccionat'
143
+ header: 'Cerca'
144
+ search_constraints_header: 'Filtres de la cerca'
145
+ search_results: 'Resultats de la cerca'
146
+ errors:
147
+ request_error: "No ha estat possible entendre la cerca"
148
+ invalid_solr_id: "El registre que heu sol·licitat no existeix."
149
+ per_page:
150
+ label: '%{count}<span class="sr-only"> per pàgina</span>'
151
+ button_label: '%{count} per pàgina' # TODO: Remove during major release
152
+ button_label_html: '%{count}<span class="d-none d-sm-inline"> per pàgina</span>'
153
+ title: 'Nombre de resultats a mostrar per pàgina'
154
+ submit: 'Actualitzar'
155
+ aria_label: 'Navegació pels resultats'
156
+ sort:
157
+ label: 'Ordenar per %{field}' # TODO: Remove during major release
158
+ label_html: 'Ordenar<span class="d-none d-sm-inline"> per %{field}</span>'
159
+ submit: 'ordenar el resultat'
160
+ form:
161
+ search_field:
162
+ label: 'Cercar per'
163
+ title: 'Opcions de cerca'
164
+ post_label: 'per'
165
+ search:
166
+ label: 'cercar per'
167
+ placeholder: 'Cercar...'
168
+ submit: 'Cerca'
169
+ pagination:
170
+ title: 'Navegació pels resultats'
171
+ pagination_info:
172
+ no_items_found: "No s'ha trobat cap %{entry_name}"
173
+ single_item_found: "S'ha trobat <strong>1</strong> %{entry_name}"
174
+ pages:
175
+ one: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> de <strong>%{total_num}</strong>'
176
+ other: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> de <strong>%{total_num}</strong>'
177
+ entry_pagination_info:
178
+ one: '<strong>1 de 1</strong>'
179
+ other: '<strong>%{current}</strong> de <strong>%{total}</strong>'
180
+ documents:
181
+ aria:
182
+ search_results: 'resultats de la cerca'
183
+ limit_search: 'limiteu la vostra cerca'
184
+ counter: '%{counter}. '
185
+ facets:
186
+ title: 'Limiteu la vostra cerca'
187
+ clear: 'Eliminar el filtre'
188
+ sort:
189
+ count: 'Numèricament'
190
+ index: 'Alfabèticament'
191
+ count: '%{number}'
192
+ more_html: 'més <span class="sr-only">%{field_name}</span> »'
193
+ selected:
194
+ remove: '[eliminar]'
195
+ missing: "[Desaparegut]"
196
+ all: Tots
197
+ pivot:
198
+ show: Mostrar
199
+ hide: Amagar
200
+ group:
201
+ toggle: 'altres »'
202
+ group:
203
+ more: 'més »'
204
+ filters:
205
+ title: 'Heu cercat per:'
206
+ label: '%{label}:'
207
+ remove:
208
+ value: 'Eliminar el filtre %{value}'
209
+ label_value: 'Eliminar el filtre %{label}: %{value}'
210
+ start_over: "Tornar a l'inici"
211
+ index:
212
+ label: '%{label}:'
213
+ show:
214
+ title: '%{document_title} - %{application_name}'
215
+ label: '%{label}:'
216
+ rss_feed: 'RSS pels resultats'
217
+ atom_feed: 'Atom pels resultats'
218
+ bookmarks:
219
+ present: "A les adreces d'interès"
220
+ absent: 'Desar'
221
+ inprogress: 'Desant...'
222
+ zero_results:
223
+ title: 'La vostra cerca no ha trobat cap resultat'
224
+ modify_search: 'Proveu de modificar la vostra cerca'
225
+ use_fewer_keywords: "Comenceu amb menys paraules, i després acoteu-la amb els enllaços de l'esquerra"
226
+ search_fields: 'heu cercat per %{search_fields}'
227
+ search_everything: 'proveu cercant-ho arreu'
228
+ view_title: 'Visualitzar els resultats com a: '
229
+ view:
230
+ list: "Llista"
231
+
232
+ entry_name:
233
+ default: 'registre'
234
+ grouped:
235
+ default: 'resultat agrupat'
236
+
237
+ did_you_mean: 'Potser volieu dir: %{options}?'
238
+
239
+ main:
240
+ aria:
241
+ main_container: 'Contingut principal'