iiif_print 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +103 -143
  3. data/app/actors/iiif_print/actors/cleanup_file_sets_actor_decorator.rb +1 -0
  4. data/app/actors/iiif_print/actors/file_set_actor_decorator.rb +1 -0
  5. data/app/helpers/iiif_print/iiif_helper_decorator.rb +1 -0
  6. data/app/indexers/concerns/iiif_print/child_work_indexer_decorator.rb +45 -0
  7. data/app/indexers/concerns/iiif_print/{file_set_indexer.rb → file_set_indexer_decorator.rb} +15 -1
  8. data/app/jobs/iiif_print/jobs/child_works_from_pdf_job.rb +8 -2
  9. data/app/listeners/iiif_print/listener.rb +1 -1
  10. data/app/models/concerns/iiif_print/solr_document_decorator.rb +47 -0
  11. data/app/models/iiif_print/iiif_search_decorator.rb +1 -0
  12. data/app/models/iiif_print/iiif_search_response_decorator.rb +1 -0
  13. data/app/presenters/iiif_print/file_set_presenter_decorator.rb +1 -0
  14. data/app/presenters/iiif_print/{iiif_manifest_presenter_behavior.rb → iiif_manifest_presenter/display_image_presenter_decorator.rb} +4 -32
  15. data/app/presenters/iiif_print/iiif_manifest_presenter_decorator.rb +35 -0
  16. data/app/presenters/iiif_print/{iiif_manifest_presenter_factory_behavior.rb → iiif_manifest_presenter_factory_decorator.rb} +2 -1
  17. data/app/renderers/hyrax/renderers/faceted_attribute_renderer_decorator.rb +1 -0
  18. data/app/services/iiif_print/derivative_rodeo_service.rb +1 -1
  19. data/app/services/iiif_print/{manifest_builder_service_behavior.rb → manifest_builder_service_decorator.rb} +2 -1
  20. data/app/services/iiif_print/simple_schema_loader_decorator.rb +1 -0
  21. data/app/transactions/hyrax/transactions/steps/delete_all_file_sets_decorator.rb +2 -0
  22. data/config/metadata/child_works_from_pdf_splitting.yaml +2 -0
  23. data/lib/iiif_print/base_derivative_service.rb +1 -1
  24. data/lib/iiif_print/blacklight_iiif_search/annotation_decorator.rb +1 -0
  25. data/lib/iiif_print/configuration.rb +1 -1
  26. data/lib/iiif_print/data/fileset_helper.rb +1 -1
  27. data/lib/iiif_print/engine.rb +6 -53
  28. data/lib/iiif_print/persistence_layer/valkyrie_adapter.rb +1 -1
  29. data/lib/iiif_print/text_extraction_derivative_service.rb +4 -1
  30. data/lib/iiif_print/version.rb +1 -1
  31. data/lib/iiif_print/works_controller_behavior_decorator.rb +13 -0
  32. data/lib/iiif_print.rb +0 -2
  33. metadata +11 -11
  34. data/app/indexers/concerns/iiif_print/child_work_indexer.rb +0 -27
  35. data/app/models/concerns/iiif_print/solr/document.rb +0 -63
  36. data/config/initializers/simple_schema_loader.rb +0 -1
  37. data/lib/iiif_print/works_controller_behavior.rb +0 -9
@@ -87,7 +87,7 @@ module IiifPrint
87
87
  )
88
88
  BatchCreateJob.perform_later(user,
89
89
  @child_work_titles,
90
- {},
90
+ @resource_types,
91
91
  @uploaded_files,
92
92
  attributes.merge!(model: child_model.to_s, split_from_pdf_id: @split_from_pdf_id).with_indifferent_access,
93
93
  operation)
@@ -99,6 +99,7 @@ module IiifPrint
99
99
  def prepare_import_data(original_pdf_path, image_files, user)
100
100
  @uploaded_files = []
101
101
  @child_work_titles = {}
102
+ @resource_types = {}
102
103
  number_of_pages_in_pdf = image_files.size
103
104
  image_files.each_with_index do |image_path, page_number|
104
105
  file_id = create_uploaded_file(user, image_path).to_s
@@ -111,6 +112,7 @@ module IiifPrint
111
112
  page_padding: number_of_digits(nbr: number_of_pages_in_pdf)
112
113
  )
113
114
 
115
+ @resource_types[file_id] = resource_types
114
116
  @uploaded_files << file_id
115
117
  @child_work_titles[file_id] = child_title
116
118
  # save child work info to create the member relationships
@@ -144,10 +146,14 @@ module IiifPrint
144
146
  uf.id
145
147
  end
146
148
 
147
- # TODO: what attributes do we need to fill in from the parent work? What about AllinsonFlex?
148
149
  def attributes
149
150
  IiifPrint.config.child_work_attributes_function.call(parent_work: @parent_work, admin_set_id: @child_admin_set_id)
150
151
  end
152
+
153
+ # TODO: Does this method need to be configurable?
154
+ def resource_types
155
+ @parent_work.try(:resource_type)
156
+ end
151
157
  end
152
158
  end
153
159
  end
@@ -15,7 +15,7 @@ module IiifPrint
15
15
  file_set = event[:file_set]
16
16
  return false unless file_set
17
17
  return false unless file_set.file_set?
18
- return false unless file_set.original_file.pdf?
18
+ return false unless file_set.original_file&.pdf?
19
19
 
20
20
  work = IiifPrint.parent_for(file_set)
21
21
  # A short-circuit to avoid fetching the underlying file.
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module IiifPrint
4
+ module SolrDocumentDecorator
5
+ def digest_sha1
6
+ digest[/urn:sha1:([\w]+)/, 1]
7
+ end
8
+
9
+ def method_missing(method_name, *args, &block)
10
+ super unless iiif_print_solr_field_names.include? method_name.to_s
11
+ self[IiifPrint.solr_name(method_name.to_s)]
12
+ end
13
+
14
+ def respond_to_missing?(method_name, include_private = false)
15
+ iiif_print_solr_field_names.include?(method_name.to_s) || super
16
+ end
17
+
18
+ # @see https://github.com/samvera/hyrax/commit/7108409c619cd2ba4ae8c836b9f3b429a7e9837b
19
+ def file_set_ids
20
+ # Yes, this looks a little odd. But the truth is the prior key (e.g. `file_set_ids_ssim`) was
21
+ # an alias of `member_ids_ssim`.
22
+ self['member_ids_ssim']
23
+ end
24
+
25
+ def any_highlighting?
26
+ response&.[]('highlighting')&.[](id)&.present?
27
+ end
28
+
29
+ def solr_document
30
+ self
31
+ end
32
+ end
33
+ end
34
+
35
+ SolrDocument.prepend(IiifPrint::SolrDocumentDecorator)
36
+ SolrDocument.attribute :is_child, Hyrax::SolrDocument::Metadata::Solr::String, 'is_child_bsi'
37
+ SolrDocument.attribute :split_from_pdf_id, Hyrax::SolrDocument::Metadata::Solr::String, 'split_from_pdf_id_ssi'
38
+ SolrDocument.attribute :digest, Hyrax::SolrDocument::Metadata::Solr::String, 'digest_ssim'
39
+
40
+ # @note These properties came from the newspaper_works gem. They are configurable.
41
+ SolrDocument.class_attribute :iiif_print_solr_field_names, default: %w[alternative_title genre
42
+ issn lccn oclcnum held_by text_direction
43
+ page_number section author photographer
44
+ volume issue_number geographic_coverage
45
+ extent publication_date height width
46
+ edition_number edition_name frequency preceded_by
47
+ succeeded_by]
@@ -33,3 +33,4 @@ module IiifPrint
33
33
  end
34
34
  end
35
35
  end
36
+ ::BlacklightIiifSearch::IiifSearch.prepend(IiifPrint::IiifSearchDecorator)
@@ -38,3 +38,4 @@ module IiifPrint
38
38
  end
39
39
  end
40
40
  end
41
+ ::BlacklightIiifSearch::IiifSearchResponse.prepend(IiifPrint::IiifSearchResponseDecorator)
@@ -9,3 +9,4 @@ module IiifPrint
9
9
  end
10
10
  end
11
11
  end
12
+ Hyrax::FileSetPresenter.prepend(IiifPrint::FileSetPresenterDecorator)
@@ -1,38 +1,9 @@
1
1
  # mixin to provide URL for IIIF Content Search service
2
2
  module IiifPrint
3
- module IiifManifestPresenterBehavior
4
- extend ActiveSupport::Concern
5
-
6
- # Extending the presenter to the base url which includes the protocol.
7
- # We need the base url to render the facet links and normalize the interface.
8
- attr_accessor :base_url
9
-
10
- def manifest_metadata
11
- # ensure we are using a SolrDocument
12
- @manifest_metadata ||= IiifPrint.manifest_metadata_from(work: model.solr_document, presenter: self)
13
- end
14
-
15
- def search_service
16
- Rails.application.routes.url_helpers.solr_document_iiif_search_url(id, host: hostname)
17
- end
18
-
19
- # OVERRIDE: Hyrax 3x, avoid nil returning to IIIF Manifest gem
20
- # @see https://github.com/samvera/iiif_manifest/blob/c408f90eba11bef908796c7236ba6bcf8d687acc/lib/iiif_manifest/v3/manifest_builder/record_property_builder.rb#L28
21
- ##
22
- # @return [Array<Hash{String => String}>]
23
- def sequence_rendering
24
- Array(try(:rendering_ids)).map do |file_set_id|
25
- rendering = file_set_presenters.find { |p| p.id == file_set_id }
26
- return [] unless rendering
27
-
28
- { '@id' => Hyrax::Engine.routes.url_helpers.download_url(rendering.id, host: hostname),
29
- 'format' => rendering.mime_type.presence || I18n.t("hyrax.manifest.unknown_mime_text"),
30
- 'label' => I18n.t("hyrax.manifest.download_text") + (rendering.label || '') }
31
- end.flatten
32
- end
33
-
3
+ module IiifManifestPresenter
34
4
  # OVERRIDE: Hyrax v3.x
35
- module DisplayImagePresenterBehavior
5
+ module DisplayImagePresenterDecorator
6
+ extend ActiveSupport::Concern
36
7
  # Extending the presenter to the base url which includes the protocol.
37
8
  # We need the base url to render the facet links and normalize the interface.
38
9
  attr_accessor :base_url
@@ -128,3 +99,4 @@ module IiifPrint
128
99
  end
129
100
  end
130
101
  end
102
+ Hyrax::IiifManifestPresenter::DisplayImagePresenter.prepend(IiifPrint::IiifManifestPresenter::DisplayImagePresenterDecorator)
@@ -0,0 +1,35 @@
1
+ # mixin to provide URL for IIIF Content Search service
2
+ module IiifPrint
3
+ module IiifManifestPresenterDecorator
4
+ extend ActiveSupport::Concern
5
+
6
+ # Extending the presenter to the base url which includes the protocol.
7
+ # We need the base url to render the facet links and normalize the interface.
8
+ attr_accessor :base_url
9
+
10
+ def manifest_metadata
11
+ # ensure we are using a SolrDocument
12
+ @manifest_metadata ||= IiifPrint.manifest_metadata_from(work: model.solr_document, presenter: self)
13
+ end
14
+
15
+ def search_service
16
+ Rails.application.routes.url_helpers.solr_document_iiif_search_url(id, host: hostname)
17
+ end
18
+
19
+ # OVERRIDE: Hyrax 3x, avoid nil returning to IIIF Manifest gem
20
+ # @see https://github.com/samvera/iiif_manifest/blob/c408f90eba11bef908796c7236ba6bcf8d687acc/lib/iiif_manifest/v3/manifest_builder/record_property_builder.rb#L28
21
+ ##
22
+ # @return [Array<Hash{String => String}>]
23
+ def sequence_rendering
24
+ Array(try(:rendering_ids)).map do |file_set_id|
25
+ rendering = file_set_presenters.find { |p| p.id == file_set_id }
26
+ return [] unless rendering
27
+
28
+ { '@id' => Hyrax::Engine.routes.url_helpers.download_url(rendering.id, host: hostname),
29
+ 'format' => rendering.mime_type.presence || I18n.t("hyrax.manifest.unknown_mime_text"),
30
+ 'label' => I18n.t("hyrax.manifest.download_text") + (rendering.label || '') }
31
+ end.flatten
32
+ end
33
+ end
34
+ end
35
+ Hyrax::IiifManifestPresenter.prepend(IiifPrint::IiifManifestPresenterDecorator)
@@ -1,5 +1,5 @@
1
1
  module IiifPrint
2
- module IiifManifestPresenterFactoryBehavior
2
+ module IiifManifestPresenterFactoryDecorator
3
3
  # This will override Hyrax::IiifManifestPresenter::Factory#build and introducing
4
4
  # the expected behavior:
5
5
  # - child work images show as canvases in the parent work manifest
@@ -31,3 +31,4 @@ module IiifPrint
31
31
  end
32
32
  end
33
33
  end
34
+ Hyrax::IiifManifestPresenter::Factory.prepend(IiifPrint::IiifManifestPresenterFactoryDecorator)
@@ -16,3 +16,4 @@ module Hyrax
16
16
  end
17
17
  end
18
18
  end
19
+ Hyrax::Renderers::FacetedAttributeRenderer.prepend(Hyrax::Renderers::FacetedAttributeRendererDecorator)
@@ -366,7 +366,7 @@ module IiifPrint
366
366
  else
367
367
  # TODO: This is the fedora URL representing the file we uploaded; is that adequate? Will we
368
368
  # have access to this file?
369
- file_set.original_file.uri.to_s
369
+ file_set.original_file&.uri&.to_s
370
370
  end
371
371
  end
372
372
 
@@ -1,6 +1,6 @@
1
1
  module IiifPrint
2
2
  # rubocop:disable Metrics/ModuleLength
3
- module ManifestBuilderServiceBehavior
3
+ module ManifestBuilderServiceDecorator
4
4
  def initialize(*args,
5
5
  version: IiifPrint.config.default_iiif_manifest_version,
6
6
  iiif_manifest_factory: iiif_manifest_factory_for(version),
@@ -154,3 +154,4 @@ module IiifPrint
154
154
  end
155
155
  # rubocop:enable Metrics/ClassLength
156
156
  end
157
+ Hyrax::ManifestBuilderService.prepend(IiifPrint::ManifestBuilderServiceDecorator)
@@ -9,3 +9,4 @@ module IiifPrint
9
9
  end
10
10
  end
11
11
  end
12
+ Hyrax::SimpleSchemaLoader.prepend(IiifPrint::SimpleSchemaLoaderDecorator)
@@ -33,3 +33,5 @@ module Hyrax
33
33
  end
34
34
  end
35
35
  end
36
+
37
+ "Hyrax::Transactions::Steps::DeleteAllFileSets".safe_constantize&.prepend(Hyrax::Transactions::Steps::DeleteAllFileSetsDecorator)
@@ -5,6 +5,7 @@ attributes:
5
5
  index_keys:
6
6
  - "is_child_bsi"
7
7
  form:
8
+ display: false
8
9
  required: false
9
10
  primary: false
10
11
  multiple: false
@@ -15,6 +16,7 @@ attributes:
15
16
  index_keys:
16
17
  - "split_from_pdf_id_ssi"
17
18
  form:
19
+ display: false
18
20
  required: false
19
21
  primary: false
20
22
  multiple: false
@@ -33,7 +33,7 @@ module IiifPrint
33
33
  # @TODO: verify if this works for ActiveFedora and if so, remove commented code.
34
34
  # If not, modify to use adapter.
35
35
  # file_set.class.image_mime_types.include?(file_set.mime_type)
36
- file_set.original_file.image?
36
+ file_set.original_file&.image?
37
37
  end
38
38
 
39
39
  def derivative_path_factory
@@ -134,3 +134,4 @@ module IiifPrint
134
134
  end
135
135
  end
136
136
  end
137
+ ::BlacklightIiifSearch::IiifSearchAnnotation.prepend(IiifPrint::BlacklightIiifSearch::AnnotationDecorator)
@@ -212,7 +212,7 @@ module IiifPrint
212
212
  visibility: 'lease',
213
213
  visibility_after_lease: lease.visibility_after_lease,
214
214
  visibility_during_lease: lease.visibility_during_lease,
215
- lease_release_date: lease.lease_release_date
215
+ lease_release_date: lease.lease_expiration_date
216
216
  }
217
217
  else
218
218
  visibility_params = { visibility: parent_work.visibility.to_s }
@@ -13,7 +13,7 @@ module IiifPrint
13
13
  def first_fileset
14
14
  # if context is fileset id (e.g. caller is view partial) string,
15
15
  # get the fileset from that id
16
- return FileSet.find(@work) if @work.is_a?(String)
16
+ return Hyrax.query_service.find_by(id: @work) if @work.is_a?(String)
17
17
  # if "work" context is a FileSet, not actual work, return it
18
18
  return @work if @work.is_a?(Hyrax::FileSet) || @work.is_a?(FileSet)
19
19
  # in most cases, get from work's members:
@@ -48,55 +48,14 @@ module IiifPrint
48
48
 
49
49
  Hyrax.publisher.subscribe(IiifPrint::Listener.new) if Hyrax.respond_to?(:publisher)
50
50
 
51
- Hyrax::IiifManifestPresenter.prepend(IiifPrint::IiifManifestPresenterBehavior)
52
- Hyrax::IiifManifestPresenter::Factory.prepend(IiifPrint::IiifManifestPresenterFactoryBehavior)
53
- Hyrax::ManifestBuilderService.prepend(IiifPrint::ManifestBuilderServiceBehavior)
54
- Hyrax::Renderers::FacetedAttributeRenderer.prepend(Hyrax::Renderers::FacetedAttributeRendererDecorator)
55
- Hyrax::WorksControllerBehavior.prepend(IiifPrint::WorksControllerBehaviorDecorator)
56
- "Hyrax::Transactions::Steps::DeleteAllFileSets".safe_constantize&.prepend(Hyrax::Transactions::Steps::DeleteAllFileSetsDecorator)
57
- # Hyku::WorksControllerBehavior was introduced in Hyku v6.0.0+. Yes we don't depend on Hyku,
58
- # but this allows us to do minimal Hyku antics with IiifPrint.
59
- 'Hyku::WorksControllerBehavior'.safe_constantize&.prepend(IiifPrint::WorksControllerBehaviorDecorator)
60
-
61
- Hyrax::FileSetPresenter.prepend(IiifPrint::FileSetPresenterDecorator)
62
- Hyrax::WorkShowPresenter.prepend(IiifPrint::WorkShowPresenterDecorator)
63
- Hyrax::IiifHelper.prepend(IiifPrint::IiifHelperDecorator)
64
-
65
- if ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_VALKYRIE', false))
66
- # Newer versions of Hyrax favor `Hyrax::Indexers::FileSetIndexer` and deprecate
67
- # `Hyrax::ValkyrieFileSetIndexer`.
68
- 'Hyrax::Indexers::FileSetIndexer'.safe_constantize&.prepend(IiifPrint::FileSetIndexer)
69
-
70
- # Versions 3.0+ of Hyrax have `Hyrax::ValkyrieFileSetIndexer` so we want to decorate that as
71
- # well. We want to use the elsif construct because later on Hyrax::ValkyrieFileSetIndexer
72
- # inherits from Hyrax::Indexers::FileSetIndexer and only implements:
73
- # `def initialize(*args); super; end`
74
- 'Hyrax::ValkyrieFileSetIndexer'.safe_constantize&.prepend(IiifPrint::FileSetIndexer)
75
-
76
- # Newer versions of Hyrax favor `Hyrax::Indexers::PcdmObjectIndexer` and deprecate
77
- # `Hyrax::ValkyrieWorkIndexer`
78
- indexers = Hyrax.config.curation_concerns.map do |concern|
79
- "#{concern}ResourceIndexer".safe_constantize
80
- end
81
- indexers.each { |indexer| indexer.prepend(IiifPrint::ChildWorkIndexer) }
82
-
83
- # Versions 3.0+ of Hyrax have `Hyrax::ValkyrieWorkIndexer` so we want to decorate that as
84
- # well. We want to use the elsif construct because later on Hyrax::ValkyrieWorkIndexer
85
- # inherits from Hyrax::Indexers::PcdmObjectIndexer and only implements:
86
- # `def initialize(*args); super; end`
87
- 'Hyrax::ValkyrieWorkIndexer'.safe_constantize&.prepend(IiifPrint::ChildWorkIndexer)
88
- else
89
- # The ActiveFedora::Base indexer for FileSets
90
- Hyrax::FileSetIndexer.prepend(IiifPrint::FileSetIndexer)
91
- # The ActiveFedora::Base indexer for Works
92
- Hyrax::WorkIndexer.prepend(IiifPrint::ChildWorkIndexer)
51
+ # Allows us to use decorator files
52
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")).sort.each do |c|
53
+ Rails.configuration.cache_classes ? require(c) : load(c)
93
54
  end
94
55
 
95
- ::BlacklightIiifSearch::IiifSearchResponse.prepend(IiifPrint::IiifSearchResponseDecorator)
96
- ::BlacklightIiifSearch::IiifSearchAnnotation.prepend(IiifPrint::BlacklightIiifSearch::AnnotationDecorator)
97
- ::BlacklightIiifSearch::IiifSearch.prepend(IiifPrint::IiifSearchDecorator)
98
- Hyrax::Actors::FileSetActor.prepend(IiifPrint::Actors::FileSetActorDecorator)
99
- Hyrax::Actors::CleanupFileSetsActor.prepend(IiifPrint::Actors::CleanupFileSetsActorDecorator)
56
+ Dir.glob(File.join(File.dirname(__FILE__), "../../lib/**/*_decorator*.rb")).sort.each do |c|
57
+ Rails.configuration.cache_classes ? require(c) : load(c)
58
+ end
100
59
 
101
60
  Hyrax.config do |config|
102
61
  config.callback.set(:after_create_fileset) do |file_set, user|
@@ -104,12 +63,6 @@ module IiifPrint
104
63
  end
105
64
  end
106
65
  end
107
-
108
- config.after_initialize do
109
- IiifPrint::Solr::Document.decorate(SolrDocument)
110
- Hyrax::IiifManifestPresenter::DisplayImagePresenter
111
- .prepend(IiifPrint::IiifManifestPresenterBehavior::DisplayImagePresenterBehavior)
112
- end
113
66
  # rubocop:enable Metrics/BlockLength
114
67
  end
115
68
  end
@@ -91,7 +91,7 @@ module IiifPrint
91
91
  end
92
92
 
93
93
  def self.pdf?(file_set)
94
- file_set.original_file.pdf?
94
+ file_set.original_file&.pdf?
95
95
  end
96
96
 
97
97
  ##
@@ -28,7 +28,10 @@ module IiifPrint
28
28
 
29
29
  ocr_derivatives.each do |extension, method_name|
30
30
  path = prepare_path(extension.to_s)
31
- write(content: ocr.public_send(method_name), path: path, extension: extension)
31
+ content = ocr.public_send(method_name)
32
+ next if content.blank?
33
+
34
+ write(content: content, path: path, extension: extension)
32
35
  end
33
36
  end
34
37
 
@@ -1,3 +1,3 @@
1
1
  module IiifPrint
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '3.0.0'.freeze
3
3
  end
@@ -0,0 +1,13 @@
1
+ module IiifPrint
2
+ module WorksControllerBehaviorDecorator
3
+ # Extending the presenter to the base url which includes the protocol.
4
+ # We need the base url to render the facet links.
5
+ def iiif_manifest_presenter
6
+ super.tap { |i| i.base_url = request.base_url }
7
+ end
8
+ end
9
+ end
10
+ Hyrax::WorksControllerBehavior.prepend(IiifPrint::WorksControllerBehaviorDecorator)
11
+ # Hyku::WorksControllerBehavior was introduced in Hyku v6.0.0+. Yes we don't depend on Hyku,
12
+ # but this allows us to do minimal Hyku antics with IiifPrint.
13
+ 'Hyku::WorksControllerBehavior'.safe_constantize&.prepend(IiifPrint::WorksControllerBehaviorDecorator)
data/lib/iiif_print.rb CHANGED
@@ -13,8 +13,6 @@ require "iiif_print/text_formats_from_alto_service"
13
13
  require "iiif_print/tiff_derivative_service"
14
14
  require "iiif_print/lineage_service"
15
15
  require "iiif_print/metadata"
16
- require "iiif_print/works_controller_behavior"
17
- require "iiif_print/blacklight_iiif_search/annotation_decorator"
18
16
  require "iiif_print/split_pdfs/base_splitter"
19
17
  require "iiif_print/split_pdfs/child_work_creation_from_pdf_service"
20
18
  require "iiif_print/split_pdfs/derivative_rodeo_splitter"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iiif_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Upton
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2024-05-30 00:00:00.000000000 Z
17
+ date: 2024-07-04 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: blacklight_iiif_search
@@ -363,8 +363,8 @@ files:
363
363
  - app/helpers/iiif_print/iiif_helper_decorator.rb
364
364
  - app/helpers/iiif_print/iiif_print_helper_behavior.rb
365
365
  - app/helpers/iiif_print_helper.rb
366
- - app/indexers/concerns/iiif_print/child_work_indexer.rb
367
- - app/indexers/concerns/iiif_print/file_set_indexer.rb
366
+ - app/indexers/concerns/iiif_print/child_work_indexer_decorator.rb
367
+ - app/indexers/concerns/iiif_print/file_set_indexer_decorator.rb
368
368
  - app/jobs/iiif_print/jobs/application_job.rb
369
369
  - app/jobs/iiif_print/jobs/child_works_from_pdf_job.rb
370
370
  - app/jobs/iiif_print/jobs/create_relationships_job.rb
@@ -372,7 +372,7 @@ files:
372
372
  - app/listeners/iiif_print/listener.rb
373
373
  - app/mailers/iiif_print/application_mailer.rb
374
374
  - app/models/concerns/iiif_print/set_child_flag.rb
375
- - app/models/concerns/iiif_print/solr/document.rb
375
+ - app/models/concerns/iiif_print/solr_document_decorator.rb
376
376
  - app/models/iiif_print/application_record.rb
377
377
  - app/models/iiif_print/derivative_attachment.rb
378
378
  - app/models/iiif_print/iiif_search_decorator.rb
@@ -380,15 +380,16 @@ files:
380
380
  - app/models/iiif_print/ingest_file_relation.rb
381
381
  - app/models/iiif_print/pending_relationship.rb
382
382
  - app/presenters/iiif_print/file_set_presenter_decorator.rb
383
- - app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb
384
- - app/presenters/iiif_print/iiif_manifest_presenter_factory_behavior.rb
383
+ - app/presenters/iiif_print/iiif_manifest_presenter/display_image_presenter_decorator.rb
384
+ - app/presenters/iiif_print/iiif_manifest_presenter_decorator.rb
385
+ - app/presenters/iiif_print/iiif_manifest_presenter_factory_decorator.rb
385
386
  - app/presenters/iiif_print/work_show_presenter_decorator.rb
386
387
  - app/renderers/hyrax/renderers/faceted_attribute_renderer_decorator.rb
387
388
  - app/search_builders/concerns/iiif_print/allinson_flex_fields.rb
388
389
  - app/search_builders/concerns/iiif_print/exclude_models.rb
389
390
  - app/search_builders/concerns/iiif_print/highlight_search_params.rb
390
391
  - app/services/iiif_print/derivative_rodeo_service.rb
391
- - app/services/iiif_print/manifest_builder_service_behavior.rb
392
+ - app/services/iiif_print/manifest_builder_service_decorator.rb
392
393
  - app/services/iiif_print/pluggable_derivative_service.rb
393
394
  - app/services/iiif_print/simple_schema_loader_decorator.rb
394
395
  - app/transactions/hyrax/transactions/iiif_print_container_decorator.rb
@@ -401,7 +402,6 @@ files:
401
402
  - app/views/hyrax/file_sets/_show_actions.html.erb
402
403
  - config/fcrepo_wrapper_test.yml
403
404
  - config/initializers/assets.rb
404
- - config/initializers/simple_schema_loader.rb
405
405
  - config/locales/iiif_print.de.yml
406
406
  - config/locales/iiif_print.en.yml
407
407
  - config/locales/iiif_print.es.yml
@@ -483,7 +483,7 @@ files:
483
483
  - lib/iiif_print/text_formats_from_alto_service.rb
484
484
  - lib/iiif_print/tiff_derivative_service.rb
485
485
  - lib/iiif_print/version.rb
486
- - lib/iiif_print/works_controller_behavior.rb
486
+ - lib/iiif_print/works_controller_behavior_decorator.rb
487
487
  - lib/samvera/derivatives.rb
488
488
  - lib/samvera/derivatives/configuration.rb
489
489
  - lib/samvera/derivatives/hyrax.rb
@@ -510,7 +510,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
510
510
  - !ruby/object:Gem::Version
511
511
  version: '0'
512
512
  requirements: []
513
- rubygems_version: 3.2.3
513
+ rubygems_version: 3.1.6
514
514
  signing_key:
515
515
  specification_version: 4
516
516
  summary: IiifPrint is a gem (Rails "engine") for Hyrax-based digital repository applications
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module IiifPrint
4
- module ChildWorkIndexer
5
- def to_solr
6
- super.tap do |index_document|
7
- index_solr_doc(index_document)
8
- end
9
- end
10
-
11
- def generate_solr_document
12
- super.tap do |solr_doc|
13
- index_solr_doc(solr_doc)
14
- end
15
- end
16
-
17
- private
18
-
19
- def index_solr_doc(solr_doc)
20
- object ||= @object || resource
21
- solr_doc['is_child_bsi'] ||= object.try(:is_child)
22
- solr_doc['split_from_pdf_id_ssi'] ||= object.try(:split_from_pdf_id)
23
- solr_doc['is_page_of_ssim'] = iiif_print_lineage_service.ancestor_ids_for(object)
24
- solr_doc['member_ids_ssim'] = iiif_print_lineage_service.descendent_member_ids_for(object)
25
- end
26
- end
27
- end
@@ -1,63 +0,0 @@
1
- module IiifPrint::Solr::Document
2
- # @note Why decorate? We want to avoid including this module via generator. And the generator
3
- # previously did two things: 1) include `IiifPrint::Solr::Document` in `SolrDocument`; 2)
4
- # add the `attribute :is_child` field to the SolrDocument. We can't rely on `included do`
5
- # block to handle that.
6
- #
7
- # This method is responsible for configuring the SolrDocument for a Hyrax/Hyku application. It
8
- # does three things:
9
- #
10
- # 1. Adds instance methods to the SolrDocument (see implementation below)
11
- # 2. Adds the `is_child` attribute to the SolrDocument
12
- # 3. Adds a class attribute (e.g. `iiif_print_solr_field_names`) to allow further customization.
13
- #
14
- # @note These `iiif_print_solr_field_names` came from the newspaper_works implementation and are
15
- # carried forward without much consideration, except to say "Make it configurable!"
16
- #
17
- # @param base [Class<SolrDocument>]
18
- # @return [Class<SolrDocument>]
19
- def self.decorate(base)
20
- base.prepend(self)
21
- base.send(:attribute, :is_child, Hyrax::SolrDocument::Metadata::Solr::String, 'is_child_bsi')
22
- base.send(:attribute, :split_from_pdf_id, Hyrax::SolrDocument::Metadata::Solr::String, 'split_from_pdf_id_ssi')
23
- base.send(:attribute, :digest, Hyrax::SolrDocument::Metadata::Solr::String, 'digest_ssim')
24
-
25
- # @note These properties came from the newspaper_works gem. They are configurable.
26
- base.class_attribute :iiif_print_solr_field_names, default: %w[alternative_title genre
27
- issn lccn oclcnum held_by text_direction
28
- page_number section author photographer
29
- volume issue_number geographic_coverage
30
- extent publication_date height width
31
- edition_number edition_name frequency preceded_by
32
- succeeded_by]
33
- base
34
- end
35
-
36
- def digest_sha1
37
- digest[/urn:sha1:([\w]+)/, 1]
38
- end
39
-
40
- def method_missing(method_name, *args, &block)
41
- super unless iiif_print_solr_field_names.include? method_name.to_s
42
- self[IiifPrint.solr_name(method_name.to_s)]
43
- end
44
-
45
- def respond_to_missing?(method_name, include_private = false)
46
- iiif_print_solr_field_names.include?(method_name.to_s) || super
47
- end
48
-
49
- # @see https://github.com/samvera/hyrax/commit/7108409c619cd2ba4ae8c836b9f3b429a7e9837b
50
- def file_set_ids
51
- # Yes, this looks a little odd. But the truth is the prior key (e.g. `file_set_ids_ssim`) was
52
- # an alias of `member_ids_ssim`.
53
- self['member_ids_ssim']
54
- end
55
-
56
- def any_highlighting?
57
- response&.[]('highlighting')&.[](id)&.present?
58
- end
59
-
60
- def solr_document
61
- self
62
- end
63
- end
@@ -1 +0,0 @@
1
- "Hyrax::SimpleSchemaLoader".safe_constantize&.prepend(IiifPrint::SimpleSchemaLoaderDecorator)
@@ -1,9 +0,0 @@
1
- module IiifPrint
2
- module WorksControllerBehaviorDecorator
3
- # Extending the presenter to the base url which includes the protocol.
4
- # We need the base url to render the facet links.
5
- def iiif_manifest_presenter
6
- super.tap { |i| i.base_url = request.base_url }
7
- end
8
- end
9
- end