From 8cfd50122ad3a3c40cad2910da74e64ebb46ca01 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 20 Jun 2024 15:36:57 -0700 Subject: [PATCH 01/50] update the reprocessor --- lib/reprocessor.rb | 53 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/lib/reprocessor.rb b/lib/reprocessor.rb index 162f0edde..d8ffeff63 100644 --- a/lib/reprocessor.rb +++ b/lib/reprocessor.rb @@ -1,7 +1,16 @@ # frozen_string_literal: true require 'singleton' - +require 'ruby-progressbar' + +## Reprocessor for iterating through large sets of ids +# There are two steps for any reprocessing. The first is to store all the ids to processin a ids.log file. +# The second to to run a lambda against every id +# No matter whether it is the first run or not, a run of the Reprocessor should always start with Reprocessor.load('tmp/imports/SOME_UNIQUE_NAME') +# This creates a context for the Reprocessor to run. After that, calling Reprocessor.capture_ids (or capture_work_ids, capture_file_set_ids or capture collection_ids) +# will record all the ids in a file +# finally, once all the ids are split, then calling Reprocessor.process_ids with a lambda (like Reprocessor.process_ids(Reprocessor.save)) to call the process on each item +# At any point, the process can be stopped (or killed) and then resumed by doing Reprocessor.load(SAME_PATH) and then calling the process_ids again. class Reprocessor # rubocop:disable Metrics/ClassLength include Singleton @@ -18,9 +27,19 @@ def initialize super end - [:capture_ids, :process_ids].each do |method| - define_singleton_method(method) do |*args| - instance.send(method, *args) + # Missing methods will be delegated to `instance` if an implementation is available. + # Else `NoMethodError` will be raised via call to `super` + def self.method_missing method_name, *args + if instance.respond_to? method_name + puts "** Defining new method: '#{method_name}'" + (class << self; self; end).instance_eval do + define_method(method_name) do |*args| + instance.send(method_name, *args) + end + end + instance.send(method_name, *args) + else + super end end @@ -52,6 +71,12 @@ def self.save File.write("#{instance.log_dir}/work_processor.json", state.to_json) end + def capture_ids + capture_collection_ids + capture_work_ids + capture_file_set_ids + end + def capture_work_ids Hyrax.config.query_index_from_valkyrie = false search = "has_model_ssim:(#{Bulkrax.curation_concerns.join(' OR ')})" @@ -174,8 +199,24 @@ def lambda_save } end + # because this takes an arg, we dont memoize + def lambda_job(job_klass) + @lambda_job = lambda { |line, _progress, job_klass| + id = line.strip + job_klass.perform_later(id) + } + end + + def lambda_af_index + @lambda_af_index ||= lambda { |line, _progress| + id = line.strip + w = ActiveFedora::Base.find(id) + w.update_index + } + end + def lambda_index - @lambda_save ||= lambda { |line, _progress| + @lambda_index ||= lambda { |line, _progress| id = line.strip w = Hyrax.query_service.find_by(id:) Hyrax.index_adapter.save(resource: w) @@ -183,7 +224,7 @@ def lambda_index end def lambda_print - @lambda_save ||= lambda { |line, progress| + @lambda_print ||= lambda { |line, progress| id = line.strip progress.log id } From 05a9ecc09dfdd89ef50793e4305e83d6d06d808b Mon Sep 17 00:00:00 2001 From: Benjamin Kiah Stroud <32469930+bkiahstroud@users.noreply.github.com> Date: Fri, 21 Jun 2024 07:10:52 -0700 Subject: [PATCH 02/50] structure code comment --- lib/reprocessor.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/reprocessor.rb b/lib/reprocessor.rb index d8ffeff63..cbf515687 100644 --- a/lib/reprocessor.rb +++ b/lib/reprocessor.rb @@ -4,13 +4,14 @@ require 'ruby-progressbar' ## Reprocessor for iterating through large sets of ids -# There are two steps for any reprocessing. The first is to store all the ids to processin a ids.log file. -# The second to to run a lambda against every id +# There are two steps for any reprocessing: +# 1. Store all the ids for processing to a ids.log file. +# 2. Run a lambda against every id. # No matter whether it is the first run or not, a run of the Reprocessor should always start with Reprocessor.load('tmp/imports/SOME_UNIQUE_NAME') # This creates a context for the Reprocessor to run. After that, calling Reprocessor.capture_ids (or capture_work_ids, capture_file_set_ids or capture collection_ids) -# will record all the ids in a file -# finally, once all the ids are split, then calling Reprocessor.process_ids with a lambda (like Reprocessor.process_ids(Reprocessor.save)) to call the process on each item -# At any point, the process can be stopped (or killed) and then resumed by doing Reprocessor.load(SAME_PATH) and then calling the process_ids again. +# will record all the ids in a file. +# Finally, once all the ids are split, calling Reprocessor.process_ids with a lambda (like Reprocessor.process_ids(Reprocessor.save)) to call the process on each item +# At any point, the process can be stopped (or killed) and then resumed by doing Reprocessor.load(SAME_PATH) and then calling #process_ids again. class Reprocessor # rubocop:disable Metrics/ClassLength include Singleton From f5fbee1af7cf71653211c9cbb5ad24d4f63b9b05 Mon Sep 17 00:00:00 2001 From: Shana Moore Date: Mon, 5 Aug 2024 16:34:14 -0700 Subject: [PATCH 03/50] Update Hyrax --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 98f2e5740..23c5c59dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -61,7 +61,7 @@ GIT GIT remote: https://github.com/samvera/hyrax.git - revision: 26fdf09c32c5a559f69df8df12345028111be0e2 + revision: 4b7495891ca2a4d0873da0feab86fd7e734648f6 branch: main specs: hyrax (5.0.1) @@ -119,7 +119,7 @@ GIT signet sprockets (= 3.7.2) tinymce-rails (~> 5.10) - valkyrie (~> 3.1.1) + valkyrie (~> 3.3) view_component (~> 2.74.1) GIT @@ -1392,7 +1392,7 @@ GEM validate_url (1.0.15) activemodel (>= 3.0.0) public_suffix - valkyrie (3.1.4) + valkyrie (3.3.0) activemodel activesupport dry-struct From b491c7f08d4124d682dd667ec0c1fd339f137b4c Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Tue, 6 Aug 2024 08:28:22 -0700 Subject: [PATCH 04/50] =?UTF-8?q?=F0=9F=90=9B=20Remove=20outdated=20blackl?= =?UTF-8?q?ight=5Frange=5Flimit=20partial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For any applications that use the Blacklight Range Limit facet, we were getting an error when the facets rendered with a proper date because we had an override of an older version of a Blacklight Range Limit gem that does not exist in the current (8.4.0) version we are using. Also we need to override Blacklight::Controller for the Cultural Repository theme because it has the facets on the Homepage. Without the override we get a no route error. --- .../blacklight/controller_decorator.rb | 21 +++ .../_range_limit_panel.html.erb | 127 ------------------ 2 files changed, 21 insertions(+), 127 deletions(-) create mode 100644 app/controllers/concerns/blacklight/controller_decorator.rb delete mode 100644 app/views/blacklight_range_limit/_range_limit_panel.html.erb diff --git a/app/controllers/concerns/blacklight/controller_decorator.rb b/app/controllers/concerns/blacklight/controller_decorator.rb new file mode 100644 index 000000000..6df29efbb --- /dev/null +++ b/app/controllers/concerns/blacklight/controller_decorator.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# OVERRIDE: Blacklight v7.35.0 to allow the Cultural Repository theme to add facets to the homepage + +module Blacklight + module ControllerDecorator + def search_facet_path(options = {}) + opts = search_state + .to_h + .merge(action: "facet", only_path: true) + .merge(options) + .except(:page) + + opts[:action] = "index" if self.class == Hyrax::HomepageController # OVERRIDE + + url_for opts + end + end +end + +Blacklight::Controller.prepend(Blacklight::ControllerDecorator) diff --git a/app/views/blacklight_range_limit/_range_limit_panel.html.erb b/app/views/blacklight_range_limit/_range_limit_panel.html.erb deleted file mode 100644 index eb38cb7cb..000000000 --- a/app/views/blacklight_range_limit/_range_limit_panel.html.erb +++ /dev/null @@ -1,127 +0,0 @@ -<%- # requires solr_config local passed in - field_config = range_config(field_name) - label = facet_field_label(field_name) - - input_label_range_begin = field_config[:input_label_range_begin] || t("blacklight.range_limit.range_begin", field_label: label) - input_label_range_end = field_config[:input_label_range_end] || t("blacklight.range_limit.range_end", field_label: label) - maxlength = field_config[:maxlength] --%> - - -<%# NOTE(dewey4iv): leaving the styling here for now so that Christy can test out what she wants this to look like %> - - -
- <% if has_selected_range_limit?(field_name) %> -
    -
  • - - <%= range_display(field_name) %> - <%= link_to remove_range_param(field_name), :class=>"remove", :title => t('blacklight.range_limit.remove_limit') do %> - - [<%= t('blacklight.range_limit.remove_limit') %>] - <% end %> - - <%= number_with_delimiter(@response.total) %> -
  • -
- - <% end %> - - <% unless selected_missing_for_range_limit?(field_name) %> - <%= form_tag search_action_path, :method => :get, class: [BlacklightRangeLimit.classes[:form], "range_#{field_name}"].join(' ') do %> - <%= render_hash_as_hidden_fields(search_state.params_for_search.except(:page)) %> - - - <% unless params.has_key?(:search_field) %> - <%= hidden_field_tag("search_field", "dummy_range") %> - <% end %> - -
- Between year: - <%= render_range_input(field_name, :begin, input_label_range_begin, maxlength) %> -
-
- and year: - <%= render_range_input(field_name, :end, input_label_range_end, maxlength) %> -
- <%= submit_tag t('blacklight.range_limit.submit_limit'), class: "#{BlacklightRangeLimit.classes[:submit]} btn btn-default btn-block" %> - <% end %> - <% end %> - - - <% unless selected_missing_for_range_limit?(field_name) %> - -
- <% if stats_for_field?(field_name) %> - - <% end %> - - <% if (min = range_results_endpoint(field_name, :min)) && - (max = range_results_endpoint(field_name, :max)) %> -

"> - -

- - <% if field_config[:segments] != false %> -
- - <% if solr_range_queries_to_a(field_name).length > 0 %> - - <%= render(:partial => "blacklight_range_limit/range_segments", :locals => {:solr_field => field_name}) %> - - <% else %> - <%= link_to('View distribution', main_app.url_for(search_state.to_h.merge(action: 'range_limit', range_field: field_name, range_start: min, range_end: max)), :class => "load_distribution") %> - <% end %> -
- <% end %> - <% end %> - - - - <% if (stats = stats_for_field(field_name)) && (stats["missing"] > 0) && (controller_name != 'advanced') %> -
    -
  • - - <%= link_to BlacklightRangeLimit.labels[:missing], add_range_missing(field_name) %> - - - <%= number_with_delimiter(stats["missing"]) %> - -
  • -
- <% end %> -
- <% end %> -
From dce02c114bc6dec876fb1817c28a2a4b62168897 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Tue, 6 Aug 2024 15:52:56 -0700 Subject: [PATCH 05/50] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Turn=20off=20autocom?= =?UTF-8?q?plete=20in=20Rails=20console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit will turn off the arguably annoying autocomplete when in Rails console. Also, not keeping a save history. --- .irbrc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .irbrc diff --git a/.irbrc b/.irbrc new file mode 100644 index 000000000..bd258bf86 --- /dev/null +++ b/.irbrc @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +IRB.conf[:USE_AUTOCOMPLETE] = false +IRB.conf[:SAVE_HISTORY] = false From c1c9b483b7a3bc159b511b691e677284fb95bb8c Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Wed, 7 Aug 2024 05:43:10 -0700 Subject: [PATCH 06/50] =?UTF-8?q?=E2=9C=85=20Fix=20Flaky=20featured=5Fcoll?= =?UTF-8?q?ection=5Flist=5Fspec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit will address a flaky spec in the FeaturedCollectionList spec. The collection titles are sequenced like "Collection Title 1", "Collection Title 2", etc and one of the tests checks if the featured collection list had the collection in title sorted order. If the test is ran after a lot of other collections have been created, we get a situation where the titles are "Collection Title 9" and "Collection Title 10". The test asserts that it should be in the order of 9 then 10, however, the actual sorting is 10 then 9 because of the way Ruby sorts the strings. ```rb ["9", "3", "10"].sort #=> ["10", "3", "9"] ``` The solution I propose is to override the sequenced collections so it'll always be 1 and 2 and can't tick all the way up into the double digits. I also the `:clean_repo` flag since I noticed that each run, there are more and more collections that accumulate. --- spec/models/featured_collection_list_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/models/featured_collection_list_spec.rb b/spec/models/featured_collection_list_spec.rb index fafa60d05..702cd02f5 100644 --- a/spec/models/featured_collection_list_spec.rb +++ b/spec/models/featured_collection_list_spec.rb @@ -2,13 +2,13 @@ require 'rails_helper' -RSpec.describe FeaturedCollectionList, type: :model do +RSpec.describe FeaturedCollectionList, :clean_repo, type: :model do subject { described_class.new } let(:user) { create(:user).tap { |u| u.add_role(:admin, Site.instance) } } let(:account) { create(:account) } - let(:collection1) { create(:collection, user:) } - let(:collection2) { create(:collection, user:) } + let(:collection1) { create(:collection, user:, title: ["Collection Title 1"]) } + let(:collection2) { create(:collection, user:, title: ["Collection Title 2"]) } describe 'featured_collections' do before do From 828da44f44c067b9e160d73cd1b6477b84e86ea4 Mon Sep 17 00:00:00 2001 From: Shana Moore Date: Wed, 7 Aug 2024 09:28:33 -0700 Subject: [PATCH 07/50] :broom: locks rails to support good jobs This specific commit is needed for good jobs to work. ref: - https://github.com/scientist-softserv/adventist_knapsack/issues/705 --- Gemfile | 4 +- Gemfile.lock | 169 +++++++++++++++++++++++++++------------------------ 2 files changed, 90 insertions(+), 83 deletions(-) diff --git a/Gemfile b/Gemfile index 4cc73942e..ef543ae38 100644 --- a/Gemfile +++ b/Gemfile @@ -12,8 +12,8 @@ end # rubocop:disable Layout/LineLength source 'https://rubygems.org' -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 6.1.7.8' +# Refer to this rails version to resolve compatibility issues with good_job +gem 'rails', '~> 6.0', github: 'rails/rails', branch: '6-1-stable', ref: 'd16199e507086e3d54d94253b7e1d87ead394d9f' gem 'active_elastic_job', github: 'active-elastic-job/active-elastic-job', ref: 'ec51c5d9dedc4a1b47f2db41f26d5fceb251e979', group: %i[aws] gem 'active-fedora', '~> 14.0' diff --git a/Gemfile.lock b/Gemfile.lock index 23c5c59dc..05f75c395 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,6 +7,93 @@ GIT aws-sdk-sqs (~> 1) rails (>= 4.2) +GIT + remote: https://github.com/rails/rails.git + revision: d16199e507086e3d54d94253b7e1d87ead394d9f + ref: d16199e507086e3d54d94253b7e1d87ead394d9f + branch: 6-1-stable + specs: + actioncable (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (>= 2.7.1) + actionmailer (6.1.7.6) + actionpack (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7.6) + actionview (= 6.1.7.6) + activesupport (= 6.1.7.6) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.6) + actionpack (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + nokogiri (>= 1.8.5) + actionview (6.1.7.6) + activesupport (= 6.1.7.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7.6) + activesupport (= 6.1.7.6) + globalid (>= 0.3.6) + activemodel (6.1.7.6) + activesupport (= 6.1.7.6) + activerecord (6.1.7.6) + activemodel (= 6.1.7.6) + activesupport (= 6.1.7.6) + activestorage (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activesupport (= 6.1.7.6) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + rails (6.1.7.6) + actioncable (= 6.1.7.6) + actionmailbox (= 6.1.7.6) + actionmailer (= 6.1.7.6) + actionpack (= 6.1.7.6) + actiontext (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activemodel (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + bundler (>= 1.15.0) + railties (= 6.1.7.6) + sprockets-rails (>= 2.0.0) + railties (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + method_source + rake (>= 12.2) + thor (~> 1.0) + GIT remote: https://github.com/samvera-labs/hyku_knapsack.git revision: 5a7c54cace96881a3963ab2fd881ca6ea3f57372 @@ -156,44 +243,6 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.8) - actionpack (= 6.1.7.8) - activejob (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) - mail (>= 2.7.1) - actionmailer (6.1.7.8) - actionpack (= 6.1.7.8) - actionview (= 6.1.7.8) - activejob (= 6.1.7.8) - activesupport (= 6.1.7.8) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.7.8) - actionview (= 6.1.7.8) - activesupport (= 6.1.7.8) - rack (~> 2.0, >= 2.0.9) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.8) - actionpack (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) - nokogiri (>= 1.8.5) - actionview (6.1.7.8) - activesupport (= 6.1.7.8) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) active-fedora (14.0.1) active-triples (>= 0.11.0, < 2.0.0) activemodel (>= 5.1) @@ -212,35 +261,14 @@ GEM active_encode (0.8.2) rails sprockets (< 4) - activejob (6.1.7.8) - activesupport (= 6.1.7.8) - globalid (>= 0.3.6) - activemodel (6.1.7.8) - activesupport (= 6.1.7.8) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (6.1.7.8) - activemodel (= 6.1.7.8) - activesupport (= 6.1.7.8) activerecord-import (1.7.0) activerecord (>= 4.2) activerecord-nulldb-adapter (1.0.1) activerecord (>= 5.2.0, < 7.2) - activestorage (6.1.7.8) - actionpack (= 6.1.7.8) - activejob (= 6.1.7.8) - activerecord (= 6.1.7.8) - activesupport (= 6.1.7.8) - marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (6.1.7.8) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) aes_key_wrap (1.1.0) @@ -1026,21 +1054,6 @@ GEM rack (~> 2.2, >= 2.2.4) rack-test (0.7.0) rack (>= 1.0, < 3) - rails (6.1.7.8) - actioncable (= 6.1.7.8) - actionmailbox (= 6.1.7.8) - actionmailer (= 6.1.7.8) - actionpack (= 6.1.7.8) - actiontext (= 6.1.7.8) - actionview (= 6.1.7.8) - activejob (= 6.1.7.8) - activemodel (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) - bundler (>= 1.15.0) - railties (= 6.1.7.8) - sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -1058,12 +1071,6 @@ GEM actionview (> 3.1) activesupport (> 3.1) railties (> 3.1) - railties (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) - method_source - rake (>= 12.2) - thor (~> 1.0) rainbow (3.1.1) rake (13.1.0) rb-fsevent (0.11.2) @@ -1515,7 +1522,7 @@ DEPENDENCIES pry-byebug puma (~> 5.6) rack-test (= 0.7.0) - rails (~> 6.1.7.8) + rails (~> 6.0)! rails-controller-testing rdf (~> 3.2) redcarpet From 658a15786f736fe61a80318661efb1bba0aeace7 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Thu, 8 Aug 2024 10:49:03 -0700 Subject: [PATCH 08/50] Remove migrate collection thumbnails rake We discovered on staging that we don't actually need this because the collection thumbnails are still presenter after migrating the collection to a collection resource. Hyrax::IndexesThumbnailsDecorator#thumbnail_path will handle the fallback which is why it is working. Ref: - https://github.com/scientist-softserv/palni_palci_knapsack/issues/110 --- ...ons_collection_thumbnails_to_valkyrie.rake | 32 -------------- ..._collection_thumbnails_to_valkyrie_spec.rb | 44 ------------------- 2 files changed, 76 deletions(-) delete mode 100644 lib/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie.rake delete mode 100644 spec/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie_spec.rb diff --git a/lib/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie.rake b/lib/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie.rake deleted file mode 100644 index de8a4cd56..000000000 --- a/lib/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie.rake +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -namespace :hyku do - desc 'migrate Hyku Commons collection thumbnails to Valkyrie' - task migrate_hyku_commons_collection_thumbnails_to_valkyrie: :environment do - in_each_account do - Collection.find_each do |collection| - # get collection solr document's thumbnail_path for each collection - doc = collection.to_solr - original_thumbnail_path = File.join(Rails.public_path, doc['thumbnail_path_ss']) - - next unless File.exist?(original_thumbnail_path) - - # save collection to make it a valkyrie resource - collection.save - collection_resource = Hyrax.query_service.find_by(id: collection.id) - - # make CollectionBrandingInfo object - CollectionBrandingInfo.new( - collection_id: collection_resource.id, - filename: File.basename(original_thumbnail_path), - role: "thumbnail", - alt_txt: "", - target_url: "" - ).save(original_thumbnail_path) - - # update solr document - Hyrax.index_adapter.save(resource: collection_resource) - end - end - end -end diff --git a/spec/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie_spec.rb b/spec/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie_spec.rb deleted file mode 100644 index 71e9abacb..000000000 --- a/spec/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe 'migrate_hyku_commons_collection_thumbnails_to_valkyrie' do - let!(:account) { FactoryBot.create(:account) } - let(:collection) { FactoryBot.create(:collection, title: ['Hyku Commons Collection']) } - let(:thumbnail_path) { File.join('/', 'uploads', 'uploaded_collection_thumbnails', collection.id, "#{collection.id}_card.jpg") } - let(:new_thumbnail_path) { Rails.root.join('public', 'branding', collection.id.to_s, 'thumbnail', "#{collection.id}_card.jpg").to_s } - let(:old_thumbnail_path) { Rails.root.join(File.join('public', thumbnail_path)) } - - before do - Rails.application.load_tasks if Rake::Task.tasks.empty? - FileUtils.mkdir_p(File.dirname(old_thumbnail_path)) - FileUtils.touch(old_thumbnail_path) - allow(Apartment::Tenant).to receive(:switch!).with(account.tenant) { |&block| block&.call } - allow(collection).to receive(:to_solr).and_return({ 'id' => collection.id, 'thumbnail_path_ss' => thumbnail_path }) - allow(Collection).to receive(:find_each).and_yield(collection) - end - - after do - FileUtils.rm_rf(File.dirname(thumbnail_path)) - Collection.destroy_all - end - - it 'migrates the old thumbnail to the branding directory' do - expect(File.exist?(old_thumbnail_path)).to eq true - expect(File.exist?(new_thumbnail_path)).to eq false - run_task('hyku:migrate_hyku_commons_collection_thumbnails_to_valkyrie') - expect(File.exist?(new_thumbnail_path)).to eq true - end - - it 'creates a CollectionBrandingInfo object for the new thumbnail path' do - expect(CollectionBrandingInfo.where(collection_id: collection.id, role: 'thumbnail').count).to eq 0 - run_task('hyku:migrate_hyku_commons_collection_thumbnails_to_valkyrie') - expect(CollectionBrandingInfo.where(collection_id: collection.id, role: 'thumbnail').count).to eq 1 - end - - it 'indexes the new thumbnail path onto the collection resource' do - original_thumbnail_path_ss = collection.to_solr['thumbnail_path_ss'] - expect(original_thumbnail_path_ss).to eq old_thumbnail_path.to_s.gsub(Rails.public_path.to_s, '') - run_task('hyku:migrate_hyku_commons_collection_thumbnails_to_valkyrie') - collection_resource = Hyrax.query_service.find_by(id: collection.id) - expect(collection_resource.to_solr['thumbnail_path_ss']).to eq new_thumbnail_path.to_s.gsub(Rails.public_path.to_s, '') - end -end From ad2ef65d5cc6cc59e396b9eb6f66fa43bf252a3a Mon Sep 17 00:00:00 2001 From: Shana Moore Date: Thu, 8 Aug 2024 14:44:07 -0700 Subject: [PATCH 09/50] :lipstick: Fix rubocop errors --- lib/reprocessor.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/reprocessor.rb b/lib/reprocessor.rb index cbf515687..f82d086b6 100644 --- a/lib/reprocessor.rb +++ b/lib/reprocessor.rb @@ -30,12 +30,14 @@ def initialize # Missing methods will be delegated to `instance` if an implementation is available. # Else `NoMethodError` will be raised via call to `super` - def self.method_missing method_name, *args + def self.method_missing(method_name, *args) if instance.respond_to? method_name + # rubocop:disable Rails/Output puts "** Defining new method: '#{method_name}'" + # rubocop:enable Rails/Output (class << self; self; end).instance_eval do - define_method(method_name) do |*args| - instance.send(method_name, *args) + define_method(method_name) do |*method_args| + instance.send(method_name, *method_args) end end instance.send(method_name, *args) @@ -44,6 +46,10 @@ def self.method_missing method_name, *args end end + def self.respond_to_missing?(method_name, include_private = false) + instance.respond_to?(method_name) || super + end + SETTINGS.each do |method| define_singleton_method(method) do |*args| instance.send(method, *args) @@ -201,7 +207,7 @@ def lambda_save end # because this takes an arg, we dont memoize - def lambda_job(job_klass) + def lambda_job(_job_klass) @lambda_job = lambda { |line, _progress, job_klass| id = line.strip job_klass.perform_later(id) From 2e5f98f03fd9266d98fd2889b0dd18de86212dd2 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Thu, 8 Aug 2024 16:02:37 -0700 Subject: [PATCH 10/50] =?UTF-8?q?=F0=9F=92=84=20Give=20IR=20theme=20banner?= =?UTF-8?q?=20text=20more=20room?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update will give a little more padding on the top of the text inside of the banner. --- .../themes/institutional_repository.scss | 9 ++++ .../layouts/homepage.html.erb | 54 ++++++++++--------- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/app/assets/stylesheets/themes/institutional_repository.scss b/app/assets/stylesheets/themes/institutional_repository.scss index 152de12e6..e877ee763 100644 --- a/app/assets/stylesheets/themes/institutional_repository.scss +++ b/app/assets/stylesheets/themes/institutional_repository.scss @@ -22,10 +22,19 @@ padding-bottom: 40px; } + .image-masthead { + margin-bottom: 2.25em; + } + // removes the blur on the banner image .image-masthead .background-container { -webkit-filter: none; filter: none; + top: 1em; + } + + .marketing-text-share-button-container { + padding-top: 4em; } ////// Navbar ////// diff --git a/app/views/themes/institutional_repository/layouts/homepage.html.erb b/app/views/themes/institutional_repository/layouts/homepage.html.erb index 8dccc49fe..66d6c265e 100644 --- a/app/views/themes/institutional_repository/layouts/homepage.html.erb +++ b/app/views/themes/institutional_repository/layouts/homepage.html.erb @@ -5,38 +5,40 @@
')">
-
- <%= render "hyrax/homepage/marketing" if controller_name == 'homepage' || controller_name == 'hyrax_contact_form' || controller_name == 'pages' %> -
- From aaf02332c45c5c0658b7b0c12a394a8cf36ea6c5 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 8 Aug 2024 16:14:43 -0700 Subject: [PATCH 11/50] add missing authorities --- config/initializers/hyrax.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/initializers/hyrax.rb b/config/initializers/hyrax.rb index 5592863f1..c9a72c833 100644 --- a/config/initializers/hyrax.rb +++ b/config/initializers/hyrax.rb @@ -243,6 +243,11 @@ Date::DATE_FORMATS[:standard] = "%m/%d/%Y" +Qa::Authorities::Local.register_subauthority('audience', 'Qa::Authorities::Local::TableBasedAuthority') +Qa::Authorities::Local.register_subauthority('discipline', 'Qa::Authorities::Local::TableBasedAuthority') +Qa::Authorities::Local.register_subauthority('education_levels', 'Qa::Authorities::Local::TableBasedAuthority') +Qa::Authorities::Local.register_subauthority('learning_resource_types', 'Qa::Authorities::Local::TableBasedAuthority') +Qa::Authorities::Local.register_subauthority('oer_types', 'Qa::Authorities::Local::TableBasedAuthority') Qa::Authorities::Local.register_subauthority('subjects', 'Qa::Authorities::Local::TableBasedAuthority') Qa::Authorities::Local.register_subauthority('languages', 'Qa::Authorities::Local::TableBasedAuthority') Qa::Authorities::Local.register_subauthority('genres', 'Qa::Authorities::Local::TableBasedAuthority') From 2cb1b4a274d7a7884ddcbe018c8dc0b1ca6fca85 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Thu, 8 Aug 2024 16:55:16 -0700 Subject: [PATCH 12/50] =?UTF-8?q?=F0=9F=A7=B9=20Remove=20globe=20from=20lo?= =?UTF-8?q?go=20partial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To align Hyku themes with Hyrax, we remove the globe since they did that some time ago. Ref: - https://github.com/samvera/hyrax/commit/0d9e361946131ff86dc2bd3682bdbe043bcc587e --- app/views/themes/cultural_repository/_logo.html.erb | 1 - app/views/themes/institutional_repository/_logo.html.erb | 1 - 2 files changed, 2 deletions(-) diff --git a/app/views/themes/cultural_repository/_logo.html.erb b/app/views/themes/cultural_repository/_logo.html.erb index 18dc50279..47a77581c 100644 --- a/app/views/themes/cultural_repository/_logo.html.erb +++ b/app/views/themes/cultural_repository/_logo.html.erb @@ -1,6 +1,5 @@ <% if logo_image %> <% else %> From 528d4b98cebf8105db7c619166563f52962af3f0 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Thu, 8 Aug 2024 17:19:04 -0700 Subject: [PATCH 13/50] =?UTF-8?q?=F0=9F=92=84=20Align=20cultural=5Freposit?= =?UTF-8?q?ory=20logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit will align the logo on the cultural_repository theme better. --- app/assets/stylesheets/themes/cultural_repository.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/stylesheets/themes/cultural_repository.scss b/app/assets/stylesheets/themes/cultural_repository.scss index 28c256d6c..08c716aa2 100644 --- a/app/assets/stylesheets/themes/cultural_repository.scss +++ b/app/assets/stylesheets/themes/cultural_repository.scss @@ -1,5 +1,10 @@ .cultural_repository { ////// Navbar ////// + .navbar-header { + display: flex; + margin-left: -10px; + } + .navbar-expand-lg .navbar-collapse { @media (min-width: 992px) { display: flex !important; From 8dc6eda6c941bc39961fe52b3c41c1cc468f0ef8 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Thu, 8 Aug 2024 22:23:06 -0700 Subject: [PATCH 14/50] =?UTF-8?q?=F0=9F=92=84=20Give=20neutral=5Frepositor?= =?UTF-8?q?y=20theme=20more=20padding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update will give the neutral_repository theme's banner text more padding and thus increasing the height of the banner area as well to mimic how it looked previously. --- app/assets/stylesheets/themes/neutral_repository.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/themes/neutral_repository.scss b/app/assets/stylesheets/themes/neutral_repository.scss index 6401e3504..ab06686ee 100644 --- a/app/assets/stylesheets/themes/neutral_repository.scss +++ b/app/assets/stylesheets/themes/neutral_repository.scss @@ -9,6 +9,10 @@ justify-content: center; } + .site-title-container { + padding: 1.5em 0; + } + ////// Basic Apperance Styles ////// .mb-40 { From 2553dee8d8eb24c03561162dbcb8a67454afe44e Mon Sep 17 00:00:00 2001 From: Shana Moore Date: Fri, 9 Aug 2024 11:33:02 -0700 Subject: [PATCH 15/50] =?UTF-8?q?=F0=9F=A7=B9=20Uses=20FileBasedAuthority?= =?UTF-8?q?=20instead=20of=20TableBasedAuthority=20for=20QA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using Qa::Authorities::Local::TableBasedAuthority for the added subauthorities broke the UI, rendering no data. We needed to use Qa::Authorities::Local::FileBasedAuthority instead. Subject, Language, and Genre are being removed because they aren't being used. --- config/initializers/hyrax.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/config/initializers/hyrax.rb b/config/initializers/hyrax.rb index c9a72c833..37e8c2684 100644 --- a/config/initializers/hyrax.rb +++ b/config/initializers/hyrax.rb @@ -243,14 +243,11 @@ Date::DATE_FORMATS[:standard] = "%m/%d/%Y" -Qa::Authorities::Local.register_subauthority('audience', 'Qa::Authorities::Local::TableBasedAuthority') -Qa::Authorities::Local.register_subauthority('discipline', 'Qa::Authorities::Local::TableBasedAuthority') -Qa::Authorities::Local.register_subauthority('education_levels', 'Qa::Authorities::Local::TableBasedAuthority') -Qa::Authorities::Local.register_subauthority('learning_resource_types', 'Qa::Authorities::Local::TableBasedAuthority') -Qa::Authorities::Local.register_subauthority('oer_types', 'Qa::Authorities::Local::TableBasedAuthority') -Qa::Authorities::Local.register_subauthority('subjects', 'Qa::Authorities::Local::TableBasedAuthority') -Qa::Authorities::Local.register_subauthority('languages', 'Qa::Authorities::Local::TableBasedAuthority') -Qa::Authorities::Local.register_subauthority('genres', 'Qa::Authorities::Local::TableBasedAuthority') +Qa::Authorities::Local.register_subauthority('audience', 'Qa::Authorities::Local::FileBasedAuthority') +Qa::Authorities::Local.register_subauthority('discipline', 'Qa::Authorities::Local::FileBasedAuthority') +Qa::Authorities::Local.register_subauthority('education_levels', 'Qa::Authorities::Local::FileBasedAuthority') +Qa::Authorities::Local.register_subauthority('learning_resource_types', 'Qa::Authorities::Local::FileBasedAuthority') +Qa::Authorities::Local.register_subauthority('oer_types', 'Qa::Authorities::Local::FileBasedAuthority') Hyrax::IiifAv.config.iiif_av_viewer = :universal_viewer From f31954fb98bba4ac2c0e614bfc01f7978c69d642 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Fri, 9 Aug 2024 14:24:20 -0700 Subject: [PATCH 16/50] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Add=20condition=20fo?= =?UTF-8?q?r=20`Valkyrie::MetadataAdapter`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding an unless condition for registering the Freyja adapter will allow knapsack to register custom queries. --- config/initializers/wings.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/config/initializers/wings.rb b/config/initializers/wings.rb index 242a43082..86f638b85 100644 --- a/config/initializers/wings.rb +++ b/config/initializers/wings.rb @@ -20,10 +20,13 @@ Wings::ModelRegistry.register(Hydra::PCDM::File, Hydra::PCDM::File) Wings::ModelRegistry.register(Hyrax::FileMetadata, Hydra::PCDM::File) - Valkyrie::MetadataAdapter.register( - Freyja::MetadataAdapter.new, - :freyja - ) + unless Valkyrie::MetadataAdapter.adapters.include?(:freyja) + Valkyrie::MetadataAdapter.register( + Freyja::MetadataAdapter.new, + :freyja + ) + end + Valkyrie.config.metadata_adapter = :freyja Hyrax.config.query_index_from_valkyrie = true Hyrax.config.index_adapter = :solr_index From 859280a8c67448e9852c6e63483039bd51d2001f Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Mon, 12 Aug 2024 11:17:57 -0700 Subject: [PATCH 17/50] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20Hyrax?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bring in changes for a new Hyrax config. Ref: - https://github.com/samvera/hyrax/commit/9d8d5f8dad116f9143e985e57ed26fd2543d4ec6 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 05f75c395..dd8dc1548 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -148,7 +148,7 @@ GIT GIT remote: https://github.com/samvera/hyrax.git - revision: 4b7495891ca2a4d0873da0feab86fd7e734648f6 + revision: 9d8d5f8dad116f9143e985e57ed26fd2543d4ec6 branch: main specs: hyrax (5.0.1) From 55daf6b7224b0e0cb023247929b93a8880f3b10e Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Mon, 12 Aug 2024 15:56:26 -0700 Subject: [PATCH 18/50] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Introduce=20the=20`H?= =?UTF-8?q?yku::Forms::Admin::Appearance`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the HykuKnapsack we are running into an issue with a decorator that was trying to alter the `#customization_params` method of the `Hyrax::Forms::Admin::Appearance` however that method was being declared in a decorator in Hyku. The decorator in Knapsack was trying to alter it prior to the method being declared and throwing a `NoMethodError`. This refactor will make the `Hyku::Forms::Admin::Appearance` inherit from the Hyrax version and override methods as needed thus declaring the `#customization_params` method so the HykuKnapsack decorator can alter it. --- .../admin/appearances_controller_decorator.rb | 1 + .../forms/admin/appearance.rb} | 134 ++++++------------ app/views/shared/_appearance_styles.html.erb | 2 +- .../forms/admin/appearance_spec.rb} | 2 +- .../admin/appearances/show.html.erb_spec.rb | 2 +- 5 files changed, 50 insertions(+), 91 deletions(-) rename app/forms/{hyrax/forms/admin/appearance_decorator.rb => hyku/forms/admin/appearance.rb} (80%) rename spec/forms/{hyrax/forms/admin/appearance_decorator_spec.rb => hyku/forms/admin/appearance_spec.rb} (93%) rename spec/views/{hyrax => hyku}/admin/appearances/show.html.erb_spec.rb (97%) diff --git a/app/controllers/hyrax/admin/appearances_controller_decorator.rb b/app/controllers/hyrax/admin/appearances_controller_decorator.rb index 247f822a2..5bba88225 100644 --- a/app/controllers/hyrax/admin/appearances_controller_decorator.rb +++ b/app/controllers/hyrax/admin/appearances_controller_decorator.rb @@ -80,3 +80,4 @@ def load_search_themes end Hyrax::Admin::AppearancesController.prepend(Hyrax::Admin::AppearancesControllerDecorator) +Hyrax::Admin::AppearancesController.form_class = Hyku::Forms::Admin::Appearance diff --git a/app/forms/hyrax/forms/admin/appearance_decorator.rb b/app/forms/hyku/forms/admin/appearance.rb similarity index 80% rename from app/forms/hyrax/forms/admin/appearance_decorator.rb rename to app/forms/hyku/forms/admin/appearance.rb index 9923cab23..a9c1c746b 100644 --- a/app/forms/hyrax/forms/admin/appearance_decorator.rb +++ b/app/forms/hyku/forms/admin/appearance.rb @@ -1,63 +1,57 @@ # frozen_string_literal: true -# OVERRIDE Hyrax v5.0.0rc2 to add custom theming - # rubocop:disable Metrics/ModuleLength -module Hyrax +module Hyku module Forms module Admin # An object to model and persist the form data for the appearance # customization menu - module AppearanceDecorator - extend ActiveSupport::Concern + # rubocop:disable Metrics/ClassLength + class Appearance < Hyrax::Forms::Admin::Appearance + delegate :banner_image, :banner_image?, :banner_image=, to: :site + delegate :logo_image, :logo_image?, :logo_image=, to: :site + delegate :favicon, :favicon?, to: :site + delegate :directory_image, :directory_image?, to: :site + delegate :default_collection_image, :default_collection_image?, to: :site + delegate :default_work_image, :default_work_image?, to: :site + + ## + # @!group Class Attributes + # + # @!attribute default_fonts + # @return [Hash] there should be at least the key "body_font" and + # "headline_font" + class_attribute :default_fonts, default: { + 'body_font' => 'Helvetica Neue, Helvetica, Arial, sans-serif;', + 'headline_font' => 'Helvetica Neue, Helvetica, Arial, sans-serif;' + } + + ## + # @!attribute default_colors + # @return [Hash] + class_attribute :default_colors, default: { + 'active_tabs_background_color' => '#337ab7', + 'default_button_background_color' => '#ffffff', + 'default_button_border_color' => '#cccccc', + 'default_button_text_color' => '#333333', + 'facet_panel_background_color' => '#f5f5f5', + 'facet_panel_text_color' => '#333333', + 'footer_link_color' => '#ffebcd', + 'footer_link_hover_color' => '#ffffff', + 'header_and_footer_text_color' => '#dcdcdc', + 'link_color' => '#2e74b2', + 'link_hover_color' => '#215480', + 'navbar_background_color' => '#000000', + 'navbar_link_background_color' => '#375f8c', + 'navbar_link_background_hover_color' => '#ffffff', + 'navbar_link_text_color' => '#eeeeee', + 'navbar_link_text_hover_color' => '#eeeeee', + 'primary_button_hover_color' => '#286090', + 'header_and_footer_background_color' => '#3c3c3c' + } # rubocop:disable Metrics/BlockLength - prepended do - delegate :banner_image, :banner_image?, :banner_image=, to: :site - delegate :logo_image, :logo_image?, :logo_image=, to: :site - delegate :favicon, :favicon?, to: :site - delegate :directory_image, :directory_image?, to: :site - delegate :default_collection_image, :default_collection_image?, to: :site - delegate :default_work_image, :default_work_image?, to: :site - - ## - # @!group Class Attributes - # - # @!attribute default_fonts - # @return [Hash] there should be at least the key "body_font" and - # "headline_font" - class_attribute :default_fonts, default: { - 'body_font' => 'Helvetica Neue, Helvetica, Arial, sans-serif;', - 'headline_font' => 'Helvetica Neue, Helvetica, Arial, sans-serif;' - } - - ## - # @!attribute default_colors - # @return [Hash] - class_attribute :default_colors, default: { - 'active_tabs_background_color' => '#337ab7', - 'default_button_background_color' => '#ffffff', - 'default_button_border_color' => '#cccccc', - 'default_button_text_color' => '#333333', - 'facet_panel_background_color' => '#f5f5f5', - 'facet_panel_text_color' => '#333333', - 'footer_link_color' => '#ffebcd', - 'footer_link_hover_color' => '#ffffff', - 'header_and_footer_text_color' => '#dcdcdc', - 'link_color' => '#2e74b2', - 'link_hover_color' => '#215480', - 'navbar_background_color' => '#000000', - 'navbar_link_background_color' => '#375f8c', - 'navbar_link_background_hover_color' => '#ffffff', - 'navbar_link_text_color' => '#eeeeee', - 'navbar_link_text_hover_color' => '#eeeeee', - 'primary_button_hover_color' => '#286090', - 'header_and_footer_background_color' => '#3c3c3c' - } - # @!endgroup Class Attributes - end - - class_methods do + class << self # Override this method if your form takes more than just the customization_params def permitted_params customization_params + image_params @@ -67,41 +61,6 @@ def image_params %i[favicon banner_image logo_image directory_image default_collection_image default_work_image] end - # @return [Array] a list of fields that are related to the banner - def banner_fields - %i[ - banner_image banner_label - ] - end - - def favicon_fields - [:favicon] - end - - # @return [Array] a list of fields that are related to the logo - def logo_fields - %i[ - logo_image logo_label - ] - end - - # @return [Array] a list of fields that are related to the directory - def directory_fields - %i[ - directory_image directory_image_label - ] - end - - # @return [Array] a list of fields that are related to default works & collections - def default_image_fields - %i[ - default_collection_image - default_work_image - default_collection_label - default_work_label - ] - end - # A list of parameters that are related to customizations # rubocop:disable Metrics/MethodLength def customization_params @@ -514,9 +473,8 @@ def format_font_names(font_style) # rubocop:enable Rails/OutputSafety end end + # rubocop:enable Metrics/ClassLength end end end # rubocop:enable Metrics/ModuleLength - -Hyrax::Forms::Admin::Appearance.prepend(Hyrax::Forms::Admin::AppearanceDecorator) diff --git a/app/views/shared/_appearance_styles.html.erb b/app/views/shared/_appearance_styles.html.erb index 43efe1931..f5497a825 100644 --- a/app/views/shared/_appearance_styles.html.erb +++ b/app/views/shared/_appearance_styles.html.erb @@ -1,5 +1,5 @@ <% # Dynamic styles added by the admin in the appearances page %> -<% appearance = Hyrax::Forms::Admin::Appearance.new %> +<% appearance = Hyku::Forms::Admin::Appearance.new %>