blacklight 7.0.0.rc1 → 7.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +30 -18
- data/.rubocop_todo.yml +308 -67
- data/.solr_wrapper.yml +8 -1
- data/.travis.yml +15 -13
- data/Gemfile +2 -0
- data/README.md +2 -2
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/Vagrantfile +2 -0
- data/app/assets/javascripts/blacklight/blacklight.js +17 -17
- data/app/assets/stylesheets/blacklight/_blacklight_base.scss +17 -16
- data/app/assets/stylesheets/blacklight/_facets.scss +2 -13
- data/app/assets/stylesheets/blacklight/_icons.scss +8 -2
- data/app/assets/stylesheets/blacklight/_search_form.scss +7 -0
- data/app/assets/stylesheets/blacklight/blacklight.scss +1 -1
- data/app/builders/blacklight/action_builder.rb +1 -0
- data/app/controllers/concerns/blacklight/bookmarks.rb +19 -13
- data/app/controllers/concerns/blacklight/catalog.rb +19 -7
- data/app/controllers/concerns/blacklight/controller.rb +12 -18
- data/app/controllers/concerns/blacklight/facet.rb +3 -0
- data/app/controllers/concerns/blacklight/search_context.rb +7 -3
- data/app/controllers/concerns/blacklight/search_history.rb +1 -6
- data/app/controllers/concerns/blacklight/token_based_user.rb +3 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +5 -1
- data/app/helpers/blacklight/configuration_helper_behavior.rb +5 -3
- data/app/helpers/blacklight/facets_helper_behavior.rb +15 -12
- data/app/helpers/blacklight/icon_helper_behavior.rb +2 -0
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -0
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/url_helper_behavior.rb +29 -14
- data/app/javascript/blacklight/checkbox_submit.js +9 -8
- data/app/javascript/blacklight/core.js +8 -6
- data/app/javascript/blacklight/modal.js +1 -3
- data/app/javascript/blacklight/search_context.js +0 -1
- data/app/models/blacklight/icon.rb +3 -0
- data/app/models/blacklight/suggest_search.rb +3 -14
- data/app/models/bookmark.rb +1 -1
- data/app/models/concerns/blacklight/document.rb +3 -1
- data/app/models/concerns/blacklight/solr/document.rb +1 -0
- data/app/models/concerns/blacklight/suggest/response.rb +5 -3
- data/app/models/concerns/blacklight/user.rb +1 -0
- data/app/models/search.rb +1 -0
- data/app/presenters/blacklight/document_presenter.rb +38 -0
- data/app/presenters/blacklight/field_presenter.rb +2 -0
- data/app/presenters/blacklight/index_presenter.rb +13 -5
- data/app/presenters/blacklight/json_presenter.rb +5 -12
- data/app/presenters/blacklight/link_alternate_presenter.rb +2 -0
- data/app/presenters/blacklight/rendering/abstract_step.rb +2 -0
- data/app/presenters/blacklight/rendering/helper_method.rb +2 -0
- data/app/presenters/blacklight/rendering/join.rb +2 -0
- data/app/presenters/blacklight/rendering/link_to_facet.rb +4 -0
- data/app/presenters/blacklight/rendering/microdata.rb +3 -0
- data/app/presenters/blacklight/rendering/pipeline.rb +2 -0
- data/app/presenters/blacklight/rendering/terminator.rb +2 -0
- data/app/presenters/blacklight/search_bar_presenter.rb +2 -0
- data/app/presenters/blacklight/show_presenter.rb +8 -5
- data/app/presenters/blacklight/thumbnail_presenter.rb +2 -0
- data/app/services/blacklight/document_factory.rb +2 -0
- data/app/services/blacklight/field_retriever.rb +2 -0
- data/app/services/blacklight/search_service.rb +7 -9
- data/app/values/blacklight/types.rb +3 -0
- data/app/views/bookmarks/index.html.erb +12 -13
- data/app/views/catalog/_citation.html.erb +4 -4
- data/app/views/catalog/_constraints.html.erb +2 -0
- data/app/views/catalog/_did_you_mean.html.erb +1 -1
- data/app/views/catalog/_document.atom.builder +17 -16
- data/app/views/catalog/_document.rss.builder +2 -0
- data/app/views/catalog/_facet_index_navigation.html.erb +5 -4
- data/app/views/catalog/_facet_layout.html.erb +3 -5
- data/app/views/catalog/_facets.html.erb +5 -4
- data/app/views/catalog/_field.json.jbuilder +10 -0
- data/app/views/catalog/_group.html.erb +1 -1
- data/app/views/catalog/_home_text.html.erb +5 -5
- data/app/views/catalog/_index.html.erb +5 -7
- data/app/views/catalog/_index_header.html.erb +1 -1
- data/app/views/catalog/_per_page_widget.html.erb +1 -1
- data/app/views/catalog/_results_pagination.html.erb +2 -2
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/catalog/_search_results.html.erb +2 -2
- data/app/views/catalog/_show.html.erb +3 -5
- data/app/views/catalog/_show_more_like_this.html.erb +1 -1
- data/app/views/catalog/_show_sidebar.html.erb +1 -1
- data/app/views/catalog/_show_tools.html.erb +1 -1
- data/app/views/catalog/_sort_widget.html.erb +1 -1
- data/app/views/catalog/_zero_results.html.erb +1 -1
- data/app/views/catalog/citation.js.erb +1 -1
- data/app/views/catalog/facet.html.erb +5 -4
- data/app/views/catalog/facet.json.jbuilder +2 -0
- data/app/views/catalog/index.atom.builder +4 -2
- data/app/views/catalog/index.json.jbuilder +29 -10
- data/app/views/catalog/index.rss.builder +2 -0
- data/app/views/catalog/opensearch.xml.builder +3 -1
- data/app/views/catalog/show.json.jbuilder +21 -0
- data/app/views/kaminari/blacklight/_first_page.html.erb +1 -1
- data/app/views/kaminari/blacklight/_last_page.html.erb +1 -1
- data/app/views/kaminari/blacklight/_next_page.html.erb +3 -3
- data/app/views/kaminari/blacklight/_page.html.erb +4 -2
- data/app/views/kaminari/blacklight/_prev_page.html.erb +2 -2
- data/app/views/layouts/blacklight.html.erb +4 -4
- data/app/views/layouts/blacklight/base.html.erb +1 -9
- data/app/views/search_history/index.html.erb +3 -3
- data/app/views/shared/_header_navbar.html.erb +1 -1
- data/app/views/shared/_modal.html.erb +2 -2
- data/blacklight.gemspec +7 -6
- data/config/i18n-tasks.yml +17 -0
- data/config/locales/blacklight.de.yml +72 -57
- data/config/locales/blacklight.en.yml +11 -1
- data/config/locales/blacklight.es.yml +15 -1
- data/config/locales/blacklight.fr.yml +17 -8
- data/config/locales/blacklight.hu.yml +3 -1
- data/config/locales/blacklight.it.yml +16 -1
- data/config/locales/blacklight.nl.yml +3 -1
- data/config/locales/blacklight.pt-BR.yml +19 -2
- data/config/locales/blacklight.sq.yml +3 -1
- data/config/locales/blacklight.zh.yml +3 -1
- data/config/routes.rb +0 -1
- data/lib/blacklight.rb +3 -0
- data/lib/blacklight/abstract_repository.rb +12 -0
- data/lib/blacklight/configuration.rb +21 -3
- data/lib/blacklight/configuration/context.rb +11 -0
- data/lib/blacklight/configuration/fields.rb +31 -26
- data/lib/blacklight/configuration/null_field.rb +2 -0
- data/lib/blacklight/engine.rb +4 -1
- data/lib/blacklight/routes/exportable.rb +1 -3
- data/lib/blacklight/routes/searchable.rb +2 -3
- data/lib/blacklight/runtime_registry.rb +2 -0
- data/lib/blacklight/search_builder.rb +2 -0
- data/lib/blacklight/search_state.rb +2 -0
- data/lib/blacklight/solr/repository.rb +34 -0
- data/lib/blacklight/solr/response/spelling.rb +1 -0
- data/lib/generators/blacklight/assets_generator.rb +10 -9
- data/lib/generators/blacklight/controller_generator.rb +1 -1
- data/lib/generators/blacklight/install_generator.rb +7 -14
- data/lib/generators/blacklight/solr_generator.rb +8 -0
- data/lib/generators/blacklight/templates/alternate_controller.rb +4 -4
- data/lib/generators/blacklight/templates/catalog_controller.rb +7 -1
- data/lib/generators/blacklight/templates/solr/conf/schema.xml +20 -22
- data/lib/generators/blacklight/user_generator.rb +2 -0
- data/lib/railties/blacklight.rake +9 -13
- data/package-lock.json +544 -406
- data/package.json +3 -2
- data/spec/controllers/alternate_controller_spec.rb +4 -3
- data/spec/controllers/application_controller_spec.rb +0 -4
- data/spec/controllers/blacklight/base_spec.rb +5 -2
- data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +4 -4
- data/spec/controllers/blacklight/facet_spec.rb +0 -1
- data/spec/controllers/blacklight/search_fields_spec.rb +25 -22
- data/spec/controllers/bookmarks_controller_spec.rb +45 -10
- data/spec/controllers/catalog_controller_spec.rb +206 -138
- data/spec/controllers/search_history_controller_spec.rb +4 -4
- data/spec/features/alternate_controller_spec.rb +3 -3
- data/spec/features/autocomplete_spec.rb +2 -0
- data/spec/features/did_you_mean_spec.rb +4 -3
- data/spec/features/facets_spec.rb +7 -7
- data/spec/features/record_view_spec.rb +11 -12
- data/spec/features/search_context_spec.rb +4 -5
- data/spec/features/search_crawler_spec.rb +3 -5
- data/spec/features/search_filters_spec.rb +44 -44
- data/spec/features/search_history_spec.rb +5 -3
- data/spec/features/search_pagination_spec.rb +3 -1
- data/spec/features/search_results_spec.rb +11 -8
- data/spec/features/search_spec.rb +3 -3
- data/spec/features/sitelinks_search_box.rb +4 -4
- data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +30 -30
- data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +65 -59
- data/spec/helpers/blacklight/hash_as_hidden_fields_behavior_spec.rb +1 -1
- data/spec/helpers/blacklight/icon_helper_behavior_spec.rb +2 -0
- data/spec/helpers/blacklight/render_constraints_helper_behavior_spec.rb +8 -3
- data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +16 -4
- data/spec/helpers/blacklight/search_history_constraints_helper_behavior_spec.rb +21 -22
- data/spec/helpers/blacklight/suggest_helper_behavior_spec.rb +6 -1
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +49 -43
- data/spec/helpers/blacklight_helper_spec.rb +28 -12
- data/spec/helpers/catalog_helper_spec.rb +50 -47
- data/spec/i18n_spec.rb +18 -0
- data/spec/integration/generators/blacklight/solr_generator_spec.rb +18 -10
- data/spec/lib/blacklight/configuration/facet_field_spec.rb +2 -0
- data/spec/lib/blacklight/configuration/field_spec.rb +3 -0
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +15 -20
- data/spec/lib/blacklight/parameters_spec.rb +3 -1
- data/spec/lib/blacklight/search_state_spec.rb +51 -34
- data/spec/lib/blacklight_spec.rb +13 -14
- data/spec/lib/tasks/blacklight_task_spec.rb +3 -5
- data/spec/models/blacklight/configurable_spec.rb +11 -13
- data/spec/models/blacklight/configuration/context_spec.rb +9 -10
- data/spec/models/blacklight/configuration_spec.rb +103 -91
- data/spec/models/blacklight/document/active_model_shim_spec.rb +5 -6
- data/spec/models/blacklight/document/cache_key_spec.rb +9 -2
- data/spec/models/blacklight/document/dublin_core_spec.rb +16 -19
- data/spec/models/blacklight/document/email_spec.rb +9 -9
- data/spec/models/blacklight/document/sms_spec.rb +9 -9
- data/spec/models/blacklight/document_spec.rb +9 -8
- data/spec/models/blacklight/facet_paginator_spec.rb +40 -30
- data/spec/models/blacklight/icon_spec.rb +12 -2
- data/spec/models/blacklight/search_builder_spec.rb +12 -3
- data/spec/models/blacklight/solr/document_spec.rb +216 -219
- data/spec/models/blacklight/solr/facet_paginator_spec.rb +6 -4
- data/spec/models/blacklight/solr/repository_spec.rb +37 -34
- data/spec/models/blacklight/solr/request_spec.rb +17 -18
- data/spec/models/blacklight/solr/response/facets_spec.rb +58 -58
- data/spec/models/blacklight/solr/response/group_response_spec.rb +16 -22
- data/spec/models/blacklight/solr/response/group_spec.rb +18 -25
- data/spec/models/blacklight/solr/response_spec.rb +48 -50
- data/spec/models/blacklight/solr/search_builder_spec.rb +120 -121
- data/spec/models/blacklight/suggest/response_spec.rb +6 -4
- data/spec/models/blacklight/suggest_search_spec.rb +9 -16
- data/spec/models/blacklight/user_spec.rb +9 -11
- data/spec/models/bookmark_spec.rb +6 -5
- data/spec/models/record_mailer_spec.rb +22 -20
- data/spec/models/search_spec.rb +18 -17
- data/spec/models/solr_document_spec.rb +6 -2
- data/spec/presenters/blacklight/document_presenter_spec.rb +86 -0
- data/spec/presenters/blacklight/index_presenter_spec.rb +186 -0
- data/spec/presenters/blacklight/json_presenter_spec.rb +59 -0
- data/spec/presenters/blacklight/link_alternate_presenter_spec.rb +3 -0
- data/spec/presenters/blacklight/search_bar_presenter_spec.rb +7 -0
- data/spec/presenters/{show_presenter_spec.rb → blacklight/show_presenter_spec.rb} +138 -91
- data/spec/presenters/pipeline_spec.rb +15 -8
- data/spec/presenters/thumbnail_presenter_spec.rb +5 -2
- data/spec/routing/catalog_routing_spec.rb +12 -14
- data/spec/services/blacklight/search_service_spec.rb +112 -70
- data/spec/spec_helper.rb +6 -2
- data/spec/support/features.rb +1 -1
- data/spec/support/features/session_helpers.rb +4 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -13
- data/spec/views/catalog/_constraints.html.erb_spec.rb +2 -3
- data/spec/views/catalog/_constraints_element.html.erb_spec.rb +9 -5
- data/spec/views/catalog/_document.html.erb_spec.rb +4 -4
- data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +4 -4
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +3 -3
- data/spec/views/catalog/_facets.html.erb_spec.rb +8 -10
- data/spec/views/catalog/_index.html.erb_spec.rb +13 -14
- data/spec/views/catalog/_index_header.html.erb_spec.rb +5 -8
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +3 -3
- data/spec/views/catalog/_show.html.erb_spec.rb +12 -13
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +4 -7
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -2
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +0 -1
- data/spec/views/catalog/_sort_widget.html.erb_spec.rb +3 -1
- data/spec/views/catalog/_thumbnail.html.erb_spec.rb +6 -8
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +7 -9
- data/spec/views/catalog/email_success.html.erb_spec.rb +0 -1
- data/spec/views/catalog/facet.html.erb_spec.rb +3 -2
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +3 -2
- data/spec/views/catalog/index.atom.builder_spec.rb +9 -4
- data/spec/views/catalog/index.html.erb_spec.rb +2 -1
- data/spec/views/catalog/index.json.jbuilder_spec.rb +84 -36
- data/spec/views/catalog/show.html.erb_spec.rb +6 -6
- data/spec/views/catalog/show.json.jbuilder_spec.rb +40 -0
- data/spec/views/catalog/sms_success.html.erb_spec.rb +0 -1
- data/spec/views/shared/_user_util_links.html.erb_spec.rb +1 -4
- data/tasks/blacklight.rake +6 -4
- data/template.demo.rb +2 -0
- metadata +50 -24
- data/app/javascript/blacklight/autofocus.js +0 -20
- data/spec/presenters/index_presenter_spec.rb +0 -150
@@ -2,17 +2,15 @@
|
|
2
2
|
# SearchService returns search results from the repository
|
3
3
|
module Blacklight
|
4
4
|
class SearchService
|
5
|
-
def initialize(
|
6
|
-
@blacklight_config =
|
5
|
+
def initialize(config:, user_params: {}, search_builder_class: config.search_builder_class)
|
6
|
+
@blacklight_config = config
|
7
7
|
@user_params = user_params
|
8
|
+
@search_builder_class = search_builder_class
|
8
9
|
end
|
9
10
|
|
10
|
-
#
|
11
|
+
# The blacklight_config is accessed by the search_builder
|
11
12
|
attr_reader :blacklight_config
|
12
13
|
|
13
|
-
# Override this method to use a search builder other than the one in the config
|
14
|
-
delegate :search_builder_class, to: :blacklight_config
|
15
|
-
|
16
14
|
def search_builder
|
17
15
|
search_builder_class.new(self)
|
18
16
|
end
|
@@ -86,11 +84,10 @@ module Blacklight
|
|
86
84
|
[user_params[:q], response.documents.flat_map { |doc| doc[field] }.uniq]
|
87
85
|
end
|
88
86
|
|
89
|
-
delegate :repository, to: :blacklight_config
|
90
|
-
|
91
87
|
private
|
92
88
|
|
93
|
-
attr_reader :user_params
|
89
|
+
attr_reader :search_builder_class, :user_params
|
90
|
+
delegate :repository, to: :blacklight_config
|
94
91
|
|
95
92
|
##
|
96
93
|
# The key to use to retrieve the grouped field to display
|
@@ -139,6 +136,7 @@ module Blacklight
|
|
139
136
|
query = search_builder
|
140
137
|
.with(user_params)
|
141
138
|
.where(blacklight_config.document_model.unique_key => ids)
|
139
|
+
.merge(blacklight_config.fetch_many_document_params)
|
142
140
|
.merge(extra_controller_params)
|
143
141
|
|
144
142
|
solr_response = repository.search(query)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Blacklight
|
2
4
|
# These are data types that blacklight can use to coerce values from the index
|
3
5
|
module Types
|
@@ -17,6 +19,7 @@ module Blacklight
|
|
17
19
|
def self.coerce(input)
|
18
20
|
field = String.coerce(input)
|
19
21
|
return if field.blank?
|
22
|
+
|
20
23
|
begin
|
21
24
|
::Date.parse(field)
|
22
25
|
rescue ArgumentError
|
@@ -1,21 +1,20 @@
|
|
1
1
|
<% @page_title = t('blacklight.bookmarks.page_title', :application_name => application_name) %>
|
2
2
|
|
3
3
|
<div id="content" class="col-md-12">
|
4
|
-
<
|
4
|
+
<h1 class='page-heading'><%= t('blacklight.bookmarks.title') %></h1>
|
5
5
|
|
6
|
-
<%- if current_or_guest_user.blank? -%>
|
6
|
+
<%- if current_or_guest_user.blank? -%>
|
7
7
|
|
8
|
-
|
8
|
+
<h2 class='section-heading'><%= t('blacklight.bookmarks.need_login') %></h2>
|
9
9
|
|
10
|
-
<%- elsif @response.documents.blank? -%>
|
10
|
+
<%- elsif @response.documents.blank? -%>
|
11
11
|
|
12
|
-
|
13
|
-
<% else %>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
<% end %>
|
12
|
+
<h2 class='section-heading'><%= t('blacklight.bookmarks.no_bookmarks') %></h2>
|
13
|
+
<% else %>
|
14
|
+
<%= render 'sort_and_per_page' %>
|
15
|
+
<%= render partial: 'tools', locals: { document_list: @response.documents } %>
|
16
|
+
<h2 class='section-heading sr-only'><%= t('blacklight.bookmarks.list_title') %></h2>
|
17
|
+
<%= render_document_index %>
|
18
|
+
<%= render 'results_pagination' %>
|
19
|
+
<% end %>
|
20
20
|
</div>
|
21
|
-
|
@@ -1,20 +1,20 @@
|
|
1
1
|
|
2
2
|
<% @documents.each do |document| %>
|
3
3
|
|
4
|
-
<
|
4
|
+
<h1 class="modal-title"><%= document_heading(document) %></h1>
|
5
5
|
|
6
6
|
<% if document.respond_to?(:export_as_mla_citation_txt) %>
|
7
|
-
<
|
7
|
+
<h2><%= t('blacklight.citation.mla') %></h2>
|
8
8
|
<%= document.send(:export_as_mla_citation_txt).html_safe %><br/><br/>
|
9
9
|
<% end %>
|
10
10
|
|
11
11
|
<% if document.respond_to?(:export_as_apa_citation_txt) %>
|
12
|
-
<
|
12
|
+
<h2><%= t('blacklight.citation.apa') %></h2>
|
13
13
|
<%= document.send(:export_as_apa_citation_txt).html_safe %><br/><br/>
|
14
14
|
<% end %>
|
15
15
|
|
16
16
|
<%- if document.respond_to?(:export_as_chicago_citation_txt) -%>
|
17
|
-
<
|
17
|
+
<h2><%= t('blacklight.citation.chicago') %></h2>
|
18
18
|
<%= document.send(:export_as_chicago_citation_txt).html_safe %>
|
19
19
|
<%- end -%>
|
20
20
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
<% if query_has_constraints? %>
|
2
2
|
<div id="appliedParams" class="clearfix constraints-container">
|
3
|
+
<h2 class="sr-only"><%= t('blacklight.search.search_constraints_header') %></h2>
|
4
|
+
|
3
5
|
<%=link_to t('blacklight.search.start_over'), start_over_path, class: "catalog_startOverLink btn btn-primary" %>
|
4
6
|
<span class="constraints-label sr-only"><%= t('blacklight.search.filters.title') %></span>
|
5
7
|
<%= render_constraints(params) %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if should_show_spellcheck_suggestions? @response %>
|
2
2
|
<div id="spell">
|
3
|
-
<
|
3
|
+
<h3 class="suggest"><em><%= t('blacklight.did_you_mean', :options => safe_join(@response.spelling.words.map { |word| link_to_query(word) }, " #{t('blacklight.or')} ")).html_safe %></em></h3>
|
4
4
|
</div>
|
5
5
|
<% end %>
|
@@ -1,21 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
xml.entry do
|
2
4
|
xml.title index_presenter(document).label(document_show_link_field(document))
|
3
|
-
|
5
|
+
|
4
6
|
# updated is required, for now we'll just set it to now, sorry
|
5
7
|
xml.updated Time.current.iso8601
|
6
|
-
|
8
|
+
|
7
9
|
xml.link "rel" => "alternate", "type" => "text/html", "href" => polymorphic_url(url_for_document(document))
|
8
10
|
# add other doc-specific formats, atom only lets us have one per
|
9
11
|
# content type, so the first one in the list wins.
|
10
|
-
xml << show_presenter(document).link_rel_alternates(unique: true)
|
11
|
-
|
12
|
+
xml << show_presenter(document).link_rel_alternates(unique: true)
|
13
|
+
|
12
14
|
xml.id polymorphic_url(url_for_document(document))
|
13
|
-
|
14
|
-
|
15
|
+
|
15
16
|
if document.to_semantic_values.key? :author
|
16
17
|
xml.author { xml.name(document.to_semantic_values[:author].first) }
|
17
18
|
end
|
18
|
-
|
19
|
+
|
19
20
|
with_format("html") do
|
20
21
|
xml.summary "type" => "html" do
|
21
22
|
xml.text! render_document_partial(document,
|
@@ -23,23 +24,23 @@ xml.entry do
|
|
23
24
|
document_counter: document_counter)
|
24
25
|
end
|
25
26
|
end
|
26
|
-
|
27
|
-
#If they asked for a format, give it to them.
|
27
|
+
|
28
|
+
#If they asked for a format, give it to them.
|
28
29
|
if (params["content_format"] &&
|
29
30
|
document.export_formats[params["content_format"].to_sym])
|
30
|
-
|
31
|
+
|
31
32
|
type = document.export_formats[params["content_format"].to_sym][:content_type]
|
32
|
-
|
33
|
+
|
33
34
|
xml.content type: type do |content_element|
|
34
35
|
data = document.export_as(params["content_format"])
|
35
|
-
|
36
|
+
|
36
37
|
# encode properly. See:
|
37
38
|
# http://tools.ietf.org/html/rfc4287#section-4.1.3.3
|
38
39
|
type = type.downcase
|
39
|
-
if (type.downcase =~
|
40
|
-
# xml, just put it right in
|
40
|
+
if (type.downcase =~ %r{\+|/xml$})
|
41
|
+
# xml, just put it right in
|
41
42
|
content_element << data
|
42
|
-
elsif (type.downcase =~ /
|
43
|
+
elsif (type.downcase =~ %r{text/})
|
43
44
|
# text, escape
|
44
45
|
content_element.text! data
|
45
46
|
else
|
@@ -47,6 +48,6 @@ xml.entry do
|
|
47
48
|
content_element << Base64.encode64(data)
|
48
49
|
end
|
49
50
|
end
|
50
|
-
|
51
|
+
|
51
52
|
end
|
52
53
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
xml.item do
|
2
4
|
xml.title(index_presenter(document).label(document_show_link_field(document)) || (document.to_semantic_values[:title].first if document.to_semantic_values.key?(:title)))
|
3
5
|
xml.link(polymorphic_url(url_for_document(document)))
|
@@ -1,9 +1,10 @@
|
|
1
1
|
<nav class="alpha-filter">
|
2
|
-
|
3
|
-
|
4
|
-
|
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>
|
5
6
|
<% @facet.index_range.each do |letter| %>
|
6
|
-
<li class="<%= 'active' if @pagination.prefix == letter %>"><%= link_to(letter, @pagination.params_for_resort_url('index', search_state.to_h.merge(@pagination.request_keys[:prefix] => letter)), data: { blacklight_modal: "preserve" }) %></li>
|
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>
|
7
8
|
<% end %>
|
8
9
|
</ol>
|
9
10
|
</nav>
|
@@ -1,10 +1,8 @@
|
|
1
1
|
<div class="card facet-limit blacklight-<%= facet_field.key.parameterize %> <%= 'facet-limit-active' if facet_field_in_params?(facet_field.key) %>">
|
2
|
-
<h3 class="
|
2
|
+
<h3 class="card-header <%= "collapsed" if should_collapse_facet?(facet_field) %> collapse-toggle facet-field-heading" aria-expanded="false" data-toggle="collapse" data-target="#<%= facet_field_id(facet_field) %>">
|
3
3
|
<%= link_to facet_field_label(facet_field.key), "##{ facet_field_id(facet_field)}", "data-turbolinks": false %>
|
4
4
|
</h3>
|
5
|
-
<div id="<%= facet_field_id(facet_field) %>" class="card-
|
6
|
-
|
7
|
-
<%= yield %>
|
8
|
-
</div>
|
5
|
+
<div id="<%= facet_field_id(facet_field) %>" class="card-body panel-collapse facet-content <%= should_collapse_facet?(facet_field) ? 'collapse' : 'show' %>">
|
6
|
+
<%= yield %>
|
9
7
|
</div>
|
10
8
|
</div>
|
@@ -1,14 +1,15 @@
|
|
1
1
|
<% # main container for facets/limits menu -%>
|
2
2
|
<% if has_facet_values? %>
|
3
3
|
<div id="facets" class="facets sidenav facets-toggleable-sm">
|
4
|
-
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#facet-panel-collapse" aria-controls="facet-panel-collapse" aria-expanded="false" aria-label="Toggle facets">
|
5
|
-
<span class="navbar-toggler-icon"></span>
|
6
|
-
</button>
|
7
4
|
|
8
|
-
<div class="
|
5
|
+
<div class="navbar">
|
9
6
|
<h2 class="facets-heading">
|
10
7
|
<%= t('blacklight.search.facets.title') %>
|
11
8
|
</h2>
|
9
|
+
|
10
|
+
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#facet-panel-collapse" aria-controls="facet-panel-collapse" aria-expanded="false" aria-label="Toggle facets">
|
11
|
+
<span class="navbar-toggler-icon"></span>
|
12
|
+
</button>
|
12
13
|
</div>
|
13
14
|
|
14
15
|
<div id="facet-panel-collapse" class="facets-collapse collapse">
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% # container for all groups in index view -%>
|
2
2
|
<div id="groups">
|
3
3
|
<%- @response.groups.each do |g| %>
|
4
|
-
<
|
4
|
+
<h2 class="group-key"><%= g.key %></h2>
|
5
5
|
<div class="grouped-documents">
|
6
6
|
<%= render_document_index g.docs %>
|
7
7
|
</div>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<div class="jumbotron text-center">
|
2
|
-
<
|
2
|
+
<h1 class="jumbotron-heading"><%= t('blacklight.welcome') %></h1>
|
3
3
|
|
4
4
|
<p class="lead">Blacklight is a multi-institutional open-source collaboration building a better discovery platform framework.</p>
|
5
|
-
|
5
|
+
|
6
6
|
<p>
|
7
7
|
<%= link_to 'Read the Documentation', 'https://github.com/projectblacklight/blacklight/wiki', class: 'btn btn-primary' %>
|
8
8
|
<%= link_to 'See Examples', 'http://projectblacklight.org', class: 'btn btn-outline-secondary' %>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
</div>
|
11
11
|
|
12
12
|
<div id="getting-started">
|
13
|
-
<
|
13
|
+
<h2>Here’s how to get started customizing your application:</h2>
|
14
14
|
|
15
15
|
<p>There are many ways to override specific behaviors and views in Blacklight. Because Blacklight is distributed as a Rails engine-based gem, all customization of Blacklight behavior should be done within your application by overriding Blacklight-provided behaviors with your own.</p>
|
16
16
|
|
@@ -31,8 +31,8 @@
|
|
31
31
|
|
32
32
|
<%# This is the same panel shown in the Rails welcome template %>
|
33
33
|
<div id="about" class="card">
|
34
|
-
<
|
35
|
-
<div id="about-content" class="card-
|
34
|
+
<h2 class='card-header collapsed collapse-toggle' data-toggle="collapse" data-target="#about-content"><a href="/rails/info/properties">About your application’s environment</a></h2>
|
35
|
+
<div id="about-content" class="card-body collapse"></div>
|
36
36
|
</div>
|
37
37
|
|
38
38
|
<script>
|
@@ -1,12 +1,10 @@
|
|
1
|
-
<% doc_presenter = index_presenter(document) %>
|
1
|
+
<% doc_presenter = index_presenter(document) %>
|
2
2
|
<%# default partial to display solr document fields in catalog index view -%>
|
3
3
|
<dl class="document-metadata dl-invert row">
|
4
|
-
|
5
|
-
<%
|
6
|
-
|
7
|
-
|
8
|
-
<dd class="blacklight-<%= field_name.parameterize %> col-md-9"><%= doc_presenter.field_value field_name %></dd>
|
9
|
-
<% end -%>
|
4
|
+
|
5
|
+
<% doc_presenter.fields_to_render.each do |field_name, field| -%>
|
6
|
+
<dt class="blacklight-<%= field_name.parameterize %> col-md-3"><%= render_index_field_label document, field: field_name %></dt>
|
7
|
+
<dd class="blacklight-<%= field_name.parameterize %> col-md-9"><%= doc_presenter.field_value field %></dd>
|
10
8
|
<% end -%>
|
11
9
|
|
12
10
|
</dl>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<%= t('blacklight.search.documents.counter', counter: counter) %>
|
16
16
|
</span>
|
17
17
|
<% end %>
|
18
|
-
<%= link_to_document document,
|
18
|
+
<%= link_to_document document, counter: counter %>
|
19
19
|
</h3>
|
20
20
|
|
21
21
|
<%= document_actions %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if show_sort_and_per_page? and !blacklight_config.per_page.blank? %>
|
2
2
|
<span class="sr-only"><%= t('blacklight.search.per_page.title') %></span>
|
3
3
|
<div id="per_page-dropdown" class="per-page-dropdown btn-group">
|
4
|
-
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown">
|
4
|
+
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
5
5
|
<%= t(:'blacklight.search.per_page.button_label', :count => current_per_page) %> <span class="caret"></span>
|
6
6
|
</button>
|
7
7
|
<div class="dropdown-menu dropdown-menu-right" role="menu">
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<% if show_pagination? and @response.total_pages > 1 %>
|
2
2
|
<div class="row record-padding">
|
3
3
|
<div class="col-md-12">
|
4
|
-
<
|
4
|
+
<nav class="pagination" role="region" aria-label="<%= t('views.pagination.aria.container_label') %>">
|
5
5
|
<%= paginate @response, :outer_window => 2, :theme => 'blacklight' %>
|
6
|
-
</
|
6
|
+
</nav>
|
7
7
|
</div>
|
8
8
|
</div>
|
9
9
|
<% end %>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<% end %>
|
16
16
|
|
17
17
|
<label for="q" class="sr-only"><%= t('blacklight.search.form.search.label') %></label>
|
18
|
-
<%= text_field_tag :q, params[:q], placeholder: t('blacklight.search.form.search.placeholder'), class: "
|
18
|
+
<%= text_field_tag :q, params[:q], placeholder: t('blacklight.search.form.search.placeholder'), class: "search-q q form-control", id: "q", autofocus: presenter.autofocus?, data: { autocomplete_enabled: presenter.autocomplete_enabled?, autocomplete_path: search_action_path(action: :suggest) } %>
|
19
19
|
|
20
20
|
<span class="input-group-append">
|
21
21
|
<button type="submit" class="btn btn-primary search-btn" id="search">
|
@@ -1,5 +1,3 @@
|
|
1
|
-
<h2 class="sr-only top-content-title"><%= t('blacklight.search.search_results_header') %></h2>
|
2
|
-
|
3
1
|
<% @page_title = t('blacklight.search.page_title.title', :constraints => render_search_to_page_title(params), :application_name => application_name) %>
|
4
2
|
|
5
3
|
<% content_for(:head) do -%>
|
@@ -10,6 +8,8 @@
|
|
10
8
|
<% end %>
|
11
9
|
|
12
10
|
<% content_for(:container_header) do -%>
|
11
|
+
<h1 class="sr-only top-content-title"><%= t('blacklight.search.header') %></h1>
|
12
|
+
|
13
13
|
<%= render 'constraints' %>
|
14
14
|
<% end %>
|
15
15
|
|
@@ -1,10 +1,8 @@
|
|
1
1
|
<% doc_presenter = show_presenter(document) %>
|
2
2
|
<%# default partial to display solr document fields in catalog show view -%>
|
3
3
|
<dl class="row dl-invert document-metadata">
|
4
|
-
<%
|
5
|
-
|
6
|
-
|
7
|
-
<dd class="blacklight-<%= field_name.parameterize %> col-md-9"><%= doc_presenter.field_value field_name %></dd>
|
8
|
-
<% end -%>
|
4
|
+
<% doc_presenter.fields_to_render.each do |field_name, field| -%>
|
5
|
+
<dt class="blacklight-<%= field_name.parameterize %> col-md-3"><%= render_document_show_field_label document, field: field_name %></dt>
|
6
|
+
<dd class="blacklight-<%= field_name.parameterize %> col-md-9"><%= doc_presenter.field_value field %></dd>
|
9
7
|
<% end -%>
|
10
8
|
</dl>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<% unless @document.more_like_this.empty? %>
|
4
4
|
<div class="card">
|
5
5
|
<div class="card-header">More Like This</div>
|
6
|
-
<div class="card-
|
6
|
+
<div class="card-body">
|
7
7
|
<%= render :collection => @document.more_like_this, :partial => 'show_more_like_this', :as => :document %>
|
8
8
|
</div>
|
9
9
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if show_sort_and_per_page? and active_sort_fields.many? %>
|
2
2
|
<div id="sort-dropdown" class="sort-dropdown btn-group">
|
3
|
-
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown">
|
3
|
+
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
4
4
|
<%= t('blacklight.search.sort.label', :field =>sort_field_label(current_sort_field.key)) %> <span class="caret"></span>
|
5
5
|
</button>
|
6
6
|
|