From b7af77979051e3383ab7a03e9e198d2c370b96c1 Mon Sep 17 00:00:00 2001 From: Hector Correa Date: Thu, 27 Jan 2022 16:33:12 -0500 Subject: [PATCH] Restyle the display of the Keywords in the Show page. (#134) * Moved keywords and license to the sidebar partial --- app/helpers/application_helper.rb | 18 ++++++++++++++++++ app/views/catalog/_show_metadata.html.erb | 6 ------ app/views/catalog/_show_sidebar.html.erb | 9 +++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b313d907..048a51ff 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -47,6 +47,24 @@ def render_field_row_search_link(title, value, field) end # rubocop:enable Rails/OutputSafety + # Outputs the HTML to render a list of subjects + # rubocop:disable Rails/OutputSafety + def render_subject_search_links(title, values, field) + return if values.count.zero? + links_html = values.map do |value| + "#{link_to(value, "/?f[#{field}][]=#{CGI.escape(value)}&q=&search_field=all_fields", class: 'badge badge-dark')}" + end + + html = <<-HTML + + #{title}: + #{links_html.join(' ')} + + HTML + html.html_safe + end + # rubocop:enable Rails/OutputSafety + # rubocop:disable Rails/OutputSafety def render_globus_download(uri) return if uri.blank? diff --git a/app/views/catalog/_show_metadata.html.erb b/app/views/catalog/_show_metadata.html.erb index 27c64fb2..e8c66c3d 100644 --- a/app/views/catalog/_show_metadata.html.erb +++ b/app/views/catalog/_show_metadata.html.erb @@ -115,12 +115,6 @@ <% @document.access_rights.each do |access_rights| %> <%= render_field_row "Access Rights", access_rights %> <% end %> - <% @document.license.each do |license| %> - <%= render_field_row "License", license %> - <% end %> - <% @document.subject.each do |subject| %> - <%= render_field_row_search_link "Subject", subject, "subject_all_ssim" %> - <% end %> <% @document.subject_classification.each do |subject_classification| %> <%= render_field_row_search_link "Classification", subject_classification, "subject_all_ssim" %> <% end %> diff --git a/app/views/catalog/_show_sidebar.html.erb b/app/views/catalog/_show_sidebar.html.erb index 42b6e0e0..0901cefb 100644 --- a/app/views/catalog/_show_sidebar.html.erb +++ b/app/views/catalog/_show_sidebar.html.erb @@ -3,3 +3,12 @@
  • <%= Rails.env.production? ? views : 'X' %> views
  • + +