diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index c50f887b0..fbaccce7d 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -110,8 +110,7 @@ def self.uploaded_field config.add_facet_field 'file_format_sim', limit: 5 config.add_facet_field 'member_of_collections_ssim', limit: 5, label: 'Collections' - - # TODO deal with part of facet changes + # TODO: deal with part of facet changes # config.add_facet_field solr_name("part", :facetable), limit: 5, label: 'Part' # config.add_facet_field solr_name("part_of", :facetable), limit: 5 # removed # config.add_facet_field solr_name("file_format", :facetable), limit: 5 @@ -123,16 +122,16 @@ def self.uploaded_field # handler defaults, or have no facets. config.add_facet_fields_to_solr_request! - # TODO ROB -# # Prior to this change, the applications specific translations were not loaded. Dogbiscuits were assuming the translations were already loaded. -# Rails.root.glob("config/locales/*.yml").each do |path| -# I18n.load_path << path.to_s -# end -# I18n.backend.reload! -# index_props = DogBiscuits.config.index_properties.collect do |prop| -# { prop => index_options(prop, DogBiscuits.config.property_mappings[prop]) } -# end -# add_index_field config, index_props + # TODO: ROB + # # Prior to this change, the applications specific translations were not loaded. Dogbiscuits were assuming the translations were already loaded. + # Rails.root.glob("config/locales/*.yml").each do |path| + # I18n.load_path << path.to_s + # end + # I18n.backend.reload! + # index_props = DogBiscuits.config.index_properties.collect do |prop| + # { prop => index_options(prop, DogBiscuits.config.property_mappings[prop]) } + # end + # add_index_field config, index_props # solr fields to be displayed in the show (single result) view # The ordering of the field names is the order of the display @@ -203,8 +202,8 @@ def self.uploaded_field # since we aren't specifying it otherwise. config.add_search_field('all_fields', label: 'All Fields', include_in_advanced_search: false) do |field| all_names = config.show_fields.values.map(&:field).join(" ") -# TODO ROB all_names = (config.show_fields.values.map { |v| v.field.to_s } + - # DogBiscuits.config.all_properties.map { |p| "#{p}_tesim" }).uniq.join(" ") + # TODO: ROB all_names = (config.show_fields.values.map { |v| v.field.to_s } + + # DogBiscuits.config.all_properties.map { |p| "#{p}_tesim" }).uniq.join(" ") title_name = 'title_tesim' field.solr_parameters = { qf: "#{all_names} file_format_tesim all_text_timv", @@ -233,7 +232,7 @@ def self.uploaded_field end config.add_search_field('creator') do |field| - # TODO ROB field.label = "Author" + # TODO: ROB field.label = "Author" field.solr_parameters = { "spellcheck.dictionary": "creator" } solr_name = 'creator_tesim' field.solr_local_parameters = { @@ -276,7 +275,9 @@ def self.uploaded_field } end + # rubocop:disable Lint/UselessAssignment date_fields = ['date_created_tesim', 'sorted_date_isi', 'sorted_month_isi'] + # rubocop:enable Lint/UselessAssignment config.add_search_field('date_created') do |field| field.solr_parameters = { diff --git a/app/controllers/hyrax/content_blocks_controller_decorator.rb b/app/controllers/hyrax/content_blocks_controller_decorator.rb index 348ac4f20..afaa2201f 100644 --- a/app/controllers/hyrax/content_blocks_controller_decorator.rb +++ b/app/controllers/hyrax/content_blocks_controller_decorator.rb @@ -6,11 +6,11 @@ module ContentBlocksControllerDecorator # override hyrax v2.9.0 added the home_text content block to permitted_params - Adding Themes def permitted_params params.require(:content_block).permit(:marketing, - :announcement, - :home_text, - :homepage_about_section_heading, - :homepage_about_section_content, - :researcher) + :announcement, + :home_text, + :homepage_about_section_heading, + :homepage_about_section_content, + :researcher) end end end diff --git a/app/controllers/hyrax/homepage_controller_decorator.rb b/app/controllers/hyrax/homepage_controller_decorator.rb index 58712bfd7..e4564a9bb 100644 --- a/app/controllers/hyrax/homepage_controller_decorator.rb +++ b/app/controllers/hyrax/homepage_controller_decorator.rb @@ -3,17 +3,16 @@ # OVERRIDE Hyrax 3.5 to add content blocks module Hyrax module HomepageControllerDecorator - def index - @presenter = presenter_class.new(current_ability, collections) - @featured_researcher = ContentBlock.for(:researcher) - @marketing_text = ContentBlock.for(:marketing) - @featured_work_list = FeaturedWorkList.new - @announcement_text = ContentBlock.for(:announcement) - @homepage_about_section_heading = ContentBlock.for(:homepage_about_section_heading) - @homepage_about_section_content = ContentBlock.for(:homepage_about_section_content) - recent - end + @presenter = presenter_class.new(current_ability, collections) + @featured_researcher = ContentBlock.for(:researcher) + @marketing_text = ContentBlock.for(:marketing) + @featured_work_list = FeaturedWorkList.new + @announcement_text = ContentBlock.for(:announcement) + @homepage_about_section_heading = ContentBlock.for(:homepage_about_section_heading) + @homepage_about_section_content = ContentBlock.for(:homepage_about_section_content) + recent + end end end diff --git a/app/models/content_block.rb b/app/models/content_block.rb index c9e72b26e..5b383f192 100644 --- a/app/models/content_block.rb +++ b/app/models/content_block.rb @@ -16,7 +16,9 @@ class ContentBlock < ApplicationRecord help: :help_page, terms: :terms_page, agreement: :agreement_page, - home_text: :home_text + home_text: :home_text, + homepage_about_section_heading: :homepage_about_section_heading, + homepage_about_section_content: :homepage_about_section_content }.freeze # NOTE: method defined outside the metaclass wrapper below because @@ -90,6 +92,22 @@ def home_text=(value) home_text.update(value: value) end + def homepage_about_section_heading + find_or_create_by(name: 'homepage_about_section_heading') + end + + def homepage_about_section_heading=(value) + homepage_about_section_heading.update(value: value) + end + + def homepage_about_section_content + find_or_create_by(name: 'homepage_about_section_content') + end + + def homepage_about_section_content=(value) + homepage_about_section_content.update(value: value) + end + def about_page find_or_create_by(name: 'about_page') end diff --git a/app/models/generic_work.rb b/app/models/generic_work.rb index 5ee8e9c01..0abd4f9db 100644 --- a/app/models/generic_work.rb +++ b/app/models/generic_work.rb @@ -12,5 +12,4 @@ class GenericWork < ActiveFedora::Base self.indexer = GenericWorkIndexer prepend OrderAlready.for(:creator) - end diff --git a/lib/wings/services/custom_queries/find_ids_by_model_decorator.rb b/lib/wings/services/custom_queries/find_ids_by_model_decorator.rb index 7cbaaef29..84e3b2c50 100644 --- a/lib/wings/services/custom_queries/find_ids_by_model_decorator.rb +++ b/lib/wings/services/custom_queries/find_ids_by_model_decorator.rb @@ -29,7 +29,12 @@ def find_ids_by_model(model:, ids: :all) response_docs.each { |doc| yield doc['id'] } break if (solr_response['start'] + solr_response['docs'].count) >= solr_response['numFound'] - solr_response = ActiveFedora::SolrService.post(solr_query, fl: 'id', rows: @query_rows, start: solr_response['start'] + @query_rows)['response'] + solr_response = ActiveFedora::SolrService.post( + solr_query, + fl: 'id', + rows: @query_rows, + start: solr_response['start'] + @query_rows + )['response'] end end end