Skip to content

Commit

Permalink
🧹 Remove use of SortTitle and arrange modules
Browse files Browse the repository at this point in the history
The `SortTitle` constant is no longer in Hyku; so gone it goes.

Also modules that add properties must be declared before the
Hyrax::BasicMetadata module.

Related to:

- notch8/palni-palci#903
  • Loading branch information
jeremyf committed Dec 15, 2023
1 parent 365dd5b commit b776475
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions app/indexers/app_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ class AppIndexer < Hyrax::WorkIndexer
# Uncomment this block if you want to add custom indexing behavior:
def generate_solr_document
super.tap do |solr_doc|
solr_doc["account_cname_tesim"] = Site.instance&.account&.cname
solr_doc['title_ssi'] = SortTitle.new(object.title.first).alphabetical
solr_doc['bulkrax_identifier_tesim'] = object.bulkrax_identifier
solr_doc['account_cname_tesim'] = Site.instance&.account&.cname
solr_doc['bulkrax_identifier_tesim'] = object.bulkrax_identifier if object.respond_to?(:bulkrax_identifier)
solr_doc['all_text_tsimv'] = full_text(object.file_sets.first&.id)
add_date(solr_doc)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/generic_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class GenericWork < ActiveFedora::Base
include ::Hyrax::WorkBehavior
include PdfBehavior
include ::Hyrax::BasicMetadata

if ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYKU_IIIF_PRINT', false))
Expand All @@ -10,7 +11,6 @@ class GenericWork < ActiveFedora::Base
pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter
)
end
include PdfBehavior

validates :title, presence: { message: 'Your work must have a title.' }

Expand Down
4 changes: 1 addition & 3 deletions app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
# `rails generate hyrax:work Image`
class Image < ActiveFedora::Base
include ::Hyrax::WorkBehavior
include PdfBehavior

if ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYKU_IIIF_PRINT', false))
include IiifPrint.model_configuration(
pdf_split_child_model: GenericWork,
pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter
)
end
include PdfBehavior

self.indexer = ImageIndexer

property :extent, predicate: ::RDF::Vocab::DC.extent, multiple: true do |index|
index.as :stored_searchable
Expand Down

0 comments on commit b776475

Please sign in to comment.