diff --git a/.rubocop.yml b/.rubocop.yml index 2cba26835..7e011bff8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -123,6 +123,7 @@ Metrics/ModuleLength: - 'app/helpers/blacklight_helper.rb' - 'app/helpers/application_helper.rb' - 'app/models/concerns/blacklight/document/json_ld.rb' + - 'lib/orangelight/browse_lists.rb' Metrics/PerceivedComplexity: Exclude: diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index e5595927c..4c30b6059 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -392,7 +392,11 @@ class CatalogController < ApplicationController config.add_show_field 'other_format_display', label: 'Other format(s)' config.add_show_field 'indexes_display', label: 'Indexes' config.add_show_field 'finding_aid_display', label: 'Finding aid' - config.add_show_field 'cumulative_index_finding_aid_display', label: "Cumulative index/\u200BFinding aid" + config.add_show_field 'cumulative_index_finding_aid_display', label: 'Cumulative index/​Finding aid' + + config.add_show_field 'subject_display', label: 'Subject(s)', helper_method: :subjectify + config.add_show_field 'form_genre_display', label: 'Form/​Genre' + config.add_show_field 'form_genre_remaining_display', label: 'Other form/​genre' config.add_show_field 'place_name_display', label: 'Place name(s)' config.add_show_field 'other_title_display', label: 'Other title(s)' config.add_show_field 'other_title_1display', hash: true diff --git a/app/helpers/orangelight/browsables_helper.rb b/app/helpers/orangelight/browsables_helper.rb index 6cb6ce224..23befd7cb 100644 --- a/app/helpers/orangelight/browsables_helper.rb +++ b/app/helpers/orangelight/browsables_helper.rb @@ -21,5 +21,15 @@ def should_check_availability?(bib_id) def current_browse_per_page params[:rpp].present? ? params[:rpp].to_i : 10 end + + def vocab_type(vocab) + if vocab == 'Library of Congress genre/form term' + 'lcgft_s' + elsif vocab == 'Rare books genre term' + 'rbgenr_s' + else + 'subject_facet' + end + end end end diff --git a/app/views/orangelight/browsables/index.html.erb b/app/views/orangelight/browsables/index.html.erb index af8afdbcf..0be25ee3d 100644 --- a/app/views/orangelight/browsables/index.html.erb +++ b/app/views/orangelight/browsables/index.html.erb @@ -24,7 +24,43 @@
- <% if @model != 'call_numbers' %> + <% if @model == 'subjects' %> +
+ + + + + + + + + <% @orangelight_browsables.each_with_index do |orangelight_subject, i| %> + <% facet_field = vocab_type(orangelight_subject.vocabulary) %> + <% if orangelight_subject.id == @match && @exact_match %> + + + <% else %> + + <% end %> + + + <% if orangelight_subject.id == @match && @exact_match %> + + + <% else %> + + <% end %> + <% if orangelight_subject.id == @match && !@exact_match %> + + + <% end %> + <% end %> + +
<%= @list_name %> Type
<%= link_to orangelight_subject.label, "/catalog/?f[#{facet_field}][]=#{CGI.escape orangelight_subject.label}", dir: orangelight_subject.dir %> + <%= "(#{orangelight_subject.count})"%><%= orangelight_subject.vocabulary %>
+ Your query "<%= @query %>" would be here.
+
+ <% elsif @model != 'call_numbers' %>