From c8be2e9c0f071808008912f3fc8f47e4d574279b Mon Sep 17 00:00:00 2001 From: Erin Sullivan Date: Fri, 24 Apr 2026 09:16:02 -0400 Subject: [PATCH 1/5] Setting up `onlinejournals` route and filter order. --- app.rb | 4 ++-- lib/search/presenters/results.rb | 18 ++++++++++++++++++ lib/services.rb | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app.rb b/app.rb index e147b4af..b9e2c333 100644 --- a/app.rb +++ b/app.rb @@ -94,7 +94,7 @@ def full_uri end Search::Datastores.each do |datastore| - if datastore.slug == "catalog" + if datastore.slug == "catalog" || datastore.slug == "onlinejournals" get "/#{datastore.slug}/record/:id" do # profile = RubyProf::Profile.new # profile.start @@ -127,7 +127,7 @@ def full_uri rescue redirect "/#{datastore.slug}/record/:id" end - get "/catalog" do + get "/#{datastore.slug}" do if params.any? @presenter = Search::Presenters.for_datastore_results(slug: datastore.slug, uri: full_uri, patron: @patron) erb :"datastores/results/layout", layout: :layout do diff --git a/lib/search/presenters/results.rb b/lib/search/presenters/results.rb index d428d51a..ae328ecc 100644 --- a/lib/search/presenters/results.rb +++ b/lib/search/presenters/results.rb @@ -71,3 +71,21 @@ def records end end end + +class Search::Presenters::Results::Onlinejournals < Search::Presenters::Results::Catalog + FILTER_ORDER = [ + "subject", + "language", + "place_of_publication", + "academic_discipline" + ] + + def filters + all_filters.map do |group| + first = group.first + OpenStruct.new(uid: first.uid, name: first.group_name, options: group.reject { |x| x.active? }) + end.select { |x| FILTER_ORDER.include?(x.uid) }.sort_by do |f| + FILTER_ORDER.index(f.uid) + end + end +end diff --git a/lib/services.rb b/lib/services.rb index f41bdb40..6aa04a28 100644 --- a/lib/services.rb +++ b/lib/services.rb @@ -32,6 +32,7 @@ S.register(:base_url) { ENV["BASE_URL"] || "http://localhost:4567" } S.register(:catalog_api_url) { ENV["CATALOG_API_URL"] || "http://catalog-api:8000" } +S.register(:onlinejournals_api_url) { ENV["CATALOG_API_URL"] || "http://catalog-api:8000" } S.register(:catalog_browse_url) { ENV["CATALOG_BROWSE_URL"] || "https://search.lib.umich.edu/catalog/browse" } From 27952f6d19e73f498b06c5b05f4f49516f59a276 Mon Sep 17 00:00:00 2001 From: Erin Sullivan Date: Fri, 24 Apr 2026 09:42:19 -0400 Subject: [PATCH 2/5] Removing boolean filters and updating filters logic for the filter order. --- lib/search/presenters/results.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/search/presenters/results.rb b/lib/search/presenters/results.rb index ae328ecc..59e45111 100644 --- a/lib/search/presenters/results.rb +++ b/lib/search/presenters/results.rb @@ -53,11 +53,12 @@ def active_filters end def filters + filter_order = self.class::FILTER_ORDER all_filters.map do |group| first = group.first OpenStruct.new(uid: first.uid, name: first.group_name, options: group.reject { |x| x.active? }) - end.select { |x| FILTER_ORDER.include?(x.uid) }.sort_by do |f| - FILTER_ORDER.index(f.uid) + end.select { |x| filter_order.include?(x.uid) }.sort_by do |f| + filter_order.index(f.uid) end end @@ -80,12 +81,7 @@ class Search::Presenters::Results::Onlinejournals < Search::Presenters::Results: "academic_discipline" ] - def filters - all_filters.map do |group| - first = group.first - OpenStruct.new(uid: first.uid, name: first.group_name, options: group.reject { |x| x.active? }) - end.select { |x| FILTER_ORDER.include?(x.uid) }.sort_by do |f| - FILTER_ORDER.index(f.uid) - end + def boolean_filters + [] end end From 342d0a4f2661c8d183a8946bcee606d46922fa68 Mon Sep 17 00:00:00 2001 From: Erin Sullivan Date: Fri, 24 Apr 2026 13:01:28 -0400 Subject: [PATCH 3/5] Setting up records for Online Journals. --- lib/search/presenters/record.rb | 1 + .../presenters/record/onlinejournals.rb | 30 +++++++++++++++++++ lib/search/presenters/results.rb | 6 ++++ 3 files changed, 37 insertions(+) create mode 100644 lib/search/presenters/record/onlinejournals.rb diff --git a/lib/search/presenters/record.rb b/lib/search/presenters/record.rb index ce45fff0..9b84bdb0 100644 --- a/lib/search/presenters/record.rb +++ b/lib/search/presenters/record.rb @@ -9,3 +9,4 @@ def self.for_datastore(datastore:, id:, size: "full") end require "search/presenters/record/catalog" +require "search/presenters/record/onlinejournals" diff --git a/lib/search/presenters/record/onlinejournals.rb b/lib/search/presenters/record/onlinejournals.rb new file mode 100644 index 00000000..1e7c6966 --- /dev/null +++ b/lib/search/presenters/record/onlinejournals.rb @@ -0,0 +1,30 @@ +require_relative "catalog" + +module Search + module Presenters + module Record + module Onlinejournals + end + end + end +end + +module Search + module Presenters + module Record + module Onlinejournals + class Base < Search::Presenters::Record::Catalog::Base + end + + class Full < Search::Presenters::Record::Catalog::Full + end + + class Brief < Search::Presenters::Record::Catalog::Brief + end + + class Field < Search::Presenters::Record::Catalog::Field + end + end + end + end +end diff --git a/lib/search/presenters/results.rb b/lib/search/presenters/results.rb index 59e45111..a2d18c8b 100644 --- a/lib/search/presenters/results.rb +++ b/lib/search/presenters/results.rb @@ -84,4 +84,10 @@ class Search::Presenters::Results::Onlinejournals < Search::Presenters::Results: def boolean_filters [] end + + def records + @results.records.map do |record| + Search::Presenters::Record::Onlinejournals::Brief.new(record) + end + end end From 04dbf6281eebe8f82bc5a47d5f9ff969af96c6eb Mon Sep 17 00:00:00 2001 From: Erin Sullivan Date: Fri, 24 Apr 2026 15:10:44 -0400 Subject: [PATCH 4/5] Record Brief information. --- .../presenters/record/onlinejournals.rb | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/search/presenters/record/onlinejournals.rb b/lib/search/presenters/record/onlinejournals.rb index 1e7c6966..210613d5 100644 --- a/lib/search/presenters/record/onlinejournals.rb +++ b/lib/search/presenters/record/onlinejournals.rb @@ -17,9 +17,29 @@ class Base < Search::Presenters::Record::Catalog::Base end class Full < Search::Presenters::Record::Catalog::Full + def url + "#{S.base_url}/onlinejournals/record/#{id}" + end + + def method_missing(method, *args, **kwargs, &block) + super unless respond_to_missing?(method) + S.logger.debug("#{method} not defined in Presenters::Record::Onlinejournals::Full") + nil + end + + def shelf_browse + @shelf_browse ||= begin + result = nil + end + end end class Brief < Search::Presenters::Record::Catalog::Brief + METADATA_METHODS = [ + :contributors, + :published, + :summary + ] end class Field < Search::Presenters::Record::Catalog::Field From 0c194ba32d741b2500c8f297104463a1e32cacb2 Mon Sep 17 00:00:00 2001 From: Erin Sullivan Date: Tue, 28 Apr 2026 15:20:28 -0400 Subject: [PATCH 5/5] Holdings. --- .../presenters/record/onlinejournals/email.rb | 11 +++++++++ .../record/onlinejournals/email_holdings.rb | 23 +++++++++++++++++++ .../onlinejournals/finding_aids_holding.rb | 10 ++++++++ .../record/onlinejournals/holdings.rb | 4 ++++ .../onlinejournals/physical_holdings.rb | 16 +++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 lib/search/presenters/record/onlinejournals/email.rb create mode 100644 lib/search/presenters/record/onlinejournals/email_holdings.rb create mode 100644 lib/search/presenters/record/onlinejournals/finding_aids_holding.rb create mode 100644 lib/search/presenters/record/onlinejournals/holdings.rb create mode 100644 lib/search/presenters/record/onlinejournals/physical_holdings.rb diff --git a/lib/search/presenters/record/onlinejournals/email.rb b/lib/search/presenters/record/onlinejournals/email.rb new file mode 100644 index 00000000..a7b57ee8 --- /dev/null +++ b/lib/search/presenters/record/onlinejournals/email.rb @@ -0,0 +1,11 @@ +require "search/presenters/record/catalog/email" + +module Search::Presenters::Record::Onlinejournals + class Email < Search::Presenters::Record::Catalog::Email + METADATA_METHODS = [ + :main_author, + :published, + :series + ] + end +end diff --git a/lib/search/presenters/record/onlinejournals/email_holdings.rb b/lib/search/presenters/record/onlinejournals/email_holdings.rb new file mode 100644 index 00000000..30813988 --- /dev/null +++ b/lib/search/presenters/record/onlinejournals/email_holdings.rb @@ -0,0 +1,23 @@ +require "search/presenters/record/catalog/email_holdings" + +class Search::Presenters::Record::Onlinejournals::EmailHoldings < Search::Presenters::Record::Catalog::EmailHoldings + # + # + # + # @param [Search::Models::Record::Catalog] data is the catalog record model + # + def initialize(data) + @data = data + @holdings = Search::Presenters::Record::Onlinejournals::Holdings.new(@data) + end + + private + + def hathi_trust_list + if non_ht_search_only_item_count == 0 + @holdings.hathi_trust + else + Search::Presenters::Record::Onlinejournals::Holdings::HathiTrustFullText.new(@data.holdings.hathi_trust) + end + end +end diff --git a/lib/search/presenters/record/onlinejournals/finding_aids_holding.rb b/lib/search/presenters/record/onlinejournals/finding_aids_holding.rb new file mode 100644 index 00000000..644fbeae --- /dev/null +++ b/lib/search/presenters/record/onlinejournals/finding_aids_holding.rb @@ -0,0 +1,10 @@ +require "search/presenters/record/catalog/finding_aids_holding" +class Search::Presenters::Record::Onlinejournals::Holdings::FindingAids < + Search::Presenters::Record::Catalog::Holdings::FindingAids + + class Item < Search::Presenters::Record::Catalog::Holdings::FindingAids::Item + def action + ItemCell::LinkTo.new(text: "Request from finding aid", url: @item.url) + end + end +end diff --git a/lib/search/presenters/record/onlinejournals/holdings.rb b/lib/search/presenters/record/onlinejournals/holdings.rb new file mode 100644 index 00000000..dbab66f6 --- /dev/null +++ b/lib/search/presenters/record/onlinejournals/holdings.rb @@ -0,0 +1,4 @@ +require "search/presenters/record/catalog/holdings" + +class Search::Presenters::Record::Onlinejournals::Holdings < Search::Presenters::Record::Catalog::Holdings +end diff --git a/lib/search/presenters/record/onlinejournals/physical_holdings.rb b/lib/search/presenters/record/onlinejournals/physical_holdings.rb new file mode 100644 index 00000000..2166208b --- /dev/null +++ b/lib/search/presenters/record/onlinejournals/physical_holdings.rb @@ -0,0 +1,16 @@ +require "search/presenters/record/catalog/physical_holdings" + +class Search::Presenters::Record::Onlinejournals::Holdings::PhysicalBase < Search::Presenters::Record::Catalog::Holdings::PhysicalBase + TableHeading = Search::Presenters::Record::Onlinejournals::Holdings::TableHeading +end + +class Search::Presenters::Record::Onlinejournals::Holdings::ItemBase < Search::Presenters::Record::Catalog::Holdings::ItemBase + ItemCell = Search::Presenters::Record::Onlinejournals::Holdings::ItemCell +end + +class Search::Presenters::Record::Onlinejournals::Holdings::Physical < + Search::Presenters::Record::Catalog::Holdings::Physical + + class Item < Search::Presenters::Record::Catalog::Holdings::Physical::Item + end +end