diff --git a/app/controllers/digital_collections_resources_controller.rb b/app/controllers/digital_collections_resources_controller.rb new file mode 100644 index 0000000..d774488 --- /dev/null +++ b/app/controllers/digital_collections_resources_controller.rb @@ -0,0 +1,7 @@ +class DigitalCollectionsResourcesController < Spotlight::ResourcesController + private + + def resource_class + DigitalCollectionsResource + end +end diff --git a/app/models/digital_collections_resource.rb b/app/models/digital_collections_resource.rb new file mode 100644 index 0000000..1f80dbe --- /dev/null +++ b/app/models/digital_collections_resource.rb @@ -0,0 +1,34 @@ +class DigitalCollectionsResource < Spotlight::Resource + # TODO: What is this indexing pipeline + def self.indexing_pipeline + @indexing_pipeline ||= super.dup.tap do |pipeline| + pipeline.transforms = [Spotlight::Etl::Sources::SourceMethodSource(:to_solr)] + pipeline.transforms + + # PR for implementing an ETL-like pattern for indexing documents + # https://github.com/projectblacklight/spotlight/pull/2625 + # # if, say, you wanted to feed the transform with multiple source documents + # # (here, by calling the `#iiif_manifest` method on the DlmeJson instance); + # # previously, the #to_solr method of the document builder would have done this extraction + # # pipeline.sources = [Spotlight::Etl::Sources::SourceMethodSource(:iiif_manifests)] + # pipeline.transforms = [ + # ->(data, p) { data.merge(DlmeJsonResourceBuilder.new(p.context.resoure).to_solr) } + # ] + + # Spotlight::Resource::IiifHarvester + # pipeline.sources = [Spotlight::Etl::Sources::SourceMethodSource(:iiif_manifests)] + # pipeline.transforms = [ + # ->(data, p) { data.merge(p.source.to_solr(exhibit: p.context.resource.exhibit)) } + # ] + pipeline.transforms + + # Spotlight::Resource::JsonUpload + # pipeline.sources = [Spotlight::Etl::Sources::StoredData] + # pipeline.transforms = [ + # Spotlight::Etl::Transforms::IdentityTransform + # ] + pipeline.transforms + end + end + + def to_solr + # TODO + end +end diff --git a/app/views/catalog/_viewer_default.html.erb b/app/views/catalog/_viewer_default.html.erb index b69e182..0ee4bf6 100644 --- a/app/views/catalog/_viewer_default.html.erb +++ b/app/views/catalog/_viewer_default.html.erb @@ -1,7 +1,7 @@ - +<%# + Overrides _openseadragon_default.html.erb from blacklight-gallery + Adds sequenceMode to showReferenceStrip for images with count > 1 +%> <% image = document.to_openseadragon(blacklight_config.view_config(:show)) diff --git a/app/views/digital_collections_resources/_form.html.erb b/app/views/digital_collections_resources/_form.html.erb new file mode 100644 index 0000000..2839c5f --- /dev/null +++ b/app/views/digital_collections_resources/_form.html.erb @@ -0,0 +1,9 @@ +<%= bootstrap_form_for([current_exhibit, @resource.becomes(DigitalCollectionsResource)], as: :resource) do |f| %> + <%= f.text_field :url %> +
+
+ <%= cancel_link @resource, :back, class: 'btn btn-secondary' %> + <%= f.submit t('.add_item'), class: 'btn btn-primary' %> +
+
+<% end if can? :manage, @resource %> diff --git a/config/initializers/spotlight_initializer.rb b/config/initializers/spotlight_initializer.rb index cd0e4ef..a3f373e 100644 --- a/config/initializers/spotlight_initializer.rb +++ b/config/initializers/spotlight_initializer.rb @@ -12,12 +12,14 @@ # ==> Appearance configuration # Spotlight::Engine.config.exhibit_main_navigation = [:curated_features, :browse, :about] Spotlight::Engine.config.resource_partials = [ - # 'spotlight/resources/external_resources_form', + 'spotlight/resources/external_resources_form', 'spotlight/resources/upload/form', 'spotlight/resources/csv_upload/form', # 'spotlight/resources/json_upload/form' 'spotlight/resources/iiif/form' ] +Spotlight::Engine.config.external_resources_partials = [] +# Spotlight::Engine.config.external_resources_partials = ['digital_collections_resources/form'] # Spotlight::Engine.config.external_resources_partials = ["portal_resources/form"] # Spotlight::Engine.config.default_browse_index_view_type = :gallery # Spotlight::Engine.config.default_contact_email = nil