From 7793cc47c1758cbf6414206032d992b85931a607 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 00:09:05 +0000 Subject: [PATCH 1/4] Bump rubocop-rspec from 2.10.0 to 2.11.1 Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.10.0 to 2.11.1. - [Release notes](https://github.com/rubocop/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.10.0...v2.11.1) --- updated-dependencies: - dependency-name: rubocop-rspec dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 7b19e0f55ce2fec6d3d80a7a37b01fca4b699dec Mon Sep 17 00:00:00 2001 From: Chris Doyle Date: Fri, 20 May 2022 11:32:08 -0400 Subject: [PATCH 2/4] MAN-1179: check for nil values --- app/views/finding_aids/show.html.erb | 12 ++++++++---- config/locales/en.yml | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) 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 @@

- <%= title sanitize @finding_aid.name.html_safe %> + <%== title sanitize @finding_aid.name %>

<%= t("manifold.finding_aids.show.headings.collection_id") %>

<%= @finding_aid.identifier %>

+ <% if @finding_aid.subject.present? %>

<%= t("manifold.finding_aids.show.headings.related_subjects") %>

    <% @finding_aid.subject.each do |subject| %>
  • <%= link_to subject, finding_aids_path(subject: subject), class: "inline" %>
  • - <% end %> + <% end if @finding_aid.subject.present? %>
+ <% end %> + <% if @finding_aid.collections.present? %>

<%= t("manifold.finding_aids.show.headings.collecting_areas") %>

    - <% @finding_aid.collections.each do |collection| %> + <% @finding_aid.collections.each do |collection| %>
  • <%= link_to collection.name, collection_path(collection), class: "inline" %>
  • - <% end %> + <% end %>
+ <% end %>

<%= t("manifold.finding_aids.show.headings.description") %>

<%= @finding_aid.description %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 69e222a55..93290537c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -465,8 +465,8 @@ en: breadcrumb: Finding Aids Directory headings: collection_id: Collection ID - related_subjects: Related Subject(s) - collecting_areas: Collecting Area(s) + related_subjects: Related Subjects + collecting_areas: Collecting Areas description: Description intro_html: >-

Finding aids are online guides to selected archival materials in the From 388444fbadd90f086a2d546a7225572bbc52cba2 Mon Sep 17 00:00:00 2001 From: Chris Doyle Date: Fri, 20 May 2022 13:18:43 -0400 Subject: [PATCH 3/4] MAN-1179: refactory JSON response to account for non-mandatory fields --- app/models/finding_aid.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/finding_aid.rb b/app/models/finding_aid.rb index 9a6556ad9..dd351c18a 100644 --- a/app/models/finding_aid.rb +++ b/app/models/finding_aid.rb @@ -47,9 +47,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 From de804db18acab33a27fe0b4719c5a410b3229c68 Mon Sep 17 00:00:00 2001 From: Chris Doyle Date: Mon, 23 May 2022 11:06:53 -0400 Subject: [PATCH 4/4] account for FAs with no subjects or collections for filtering --- app/controllers/finding_aids_controller.rb | 2 ++ app/models/finding_aid.rb | 2 ++ 2 files changed, 4 insertions(+) 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 dd351c18a..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? }