diff --git a/Gemfile.lock b/Gemfile.lock index b39025c85..a9d2d4e3b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -479,13 +479,13 @@ GEM rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.17.0) + rubocop-ast (1.18.0) parser (>= 3.1.1.0) rubocop-rails (2.14.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) - rubocop-rspec (2.10.0) + rubocop-rspec (2.11.1) rubocop (~> 1.19) ruby-graphviz (1.2.5) rexml diff --git a/app/controllers/finding_aids_controller.rb b/app/controllers/finding_aids_controller.rb index e9ecf5a56..0f872026b 100644 --- a/app/controllers/finding_aids_controller.rb +++ b/app/controllers/finding_aids_controller.rb @@ -33,6 +33,7 @@ def return_aids def get_subject_filter_values(finding_aids) finding_aids + .has_subjects .map(&:subject) .flatten .sort @@ -41,6 +42,7 @@ def get_subject_filter_values(finding_aids) def get_collection_filter_values(finding_aids) finding_aids + .has_collections .map(&:collections) .flatten .sort diff --git a/app/models/finding_aid.rb b/app/models/finding_aid.rb index 9a6556ad9..7ad2505a7 100644 --- a/app/models/finding_aid.rb +++ b/app/models/finding_aid.rb @@ -20,6 +20,8 @@ class FindingAid < ApplicationRecord has_rich_text :covid_alert validates :collection_id, collection_or_subject: true + scope :has_subjects, -> { where.not(subject: []) } + scope :has_collections, -> { where.not(collections: []) } scope :with_subject, ->(subjects) { where(subject_query(subjects), *(subjects.map { |s| "%#{s}%" })) if subjects.present? } @@ -47,9 +49,11 @@ def schema_dot_org_type end def additional_schema_dot_org_attributes + subjects = subject.map(&:inspect).join(", ") if subject.present? + collections = collections.map(&:inspect).join(", ") if collections.present? { - about: subject.map(&:inspect).join(", "), - isPartOf: collections.map(&:inspect).join(", "), + about: subjects, + isPartOf: collections, identifier: identifier } end diff --git a/app/views/finding_aids/show.html.erb b/app/views/finding_aids/show.html.erb index b89f8dc8c..1ae5a0f79 100644 --- a/app/views/finding_aids/show.html.erb +++ b/app/views/finding_aids/show.html.erb @@ -8,26 +8,30 @@
<%= @finding_aid.identifier %>
+ <% if @finding_aid.subject.present? %>Finding aids are online guides to selected archival materials in the