diff --git a/app/controllers/application_controller_decorator.rb b/app/controllers/application_controller_decorator.rb index 3273c35..a02af69 100644 --- a/app/controllers/application_controller_decorator.rb +++ b/app/controllers/application_controller_decorator.rb @@ -47,7 +47,7 @@ def deny_access_for_anonymous_user(exception, json_message) # rubocop:disable Metrics/AbcSize def global_request_logging FileUtils.mkdir_p(Rails.root.join('log')) unless Dir.exist?(Rails.root.join('log')) - rl = ActiveSupport::Logger.new('log/request.log') + rl = ActiveSupport::Logger.new(Rails.root.join('log', 'request.log')) if request.host&.match('blc.hykucommons') http_request_header_keys = request.headers.env.keys.select { |header_name| header_name.match("^HTTP.*|^X-User.*") } http_request_headers = request.headers.env.select { |header_name, _header_value| http_request_header_keys.index(header_name) } diff --git a/app/controllers/hyrax/cdls_controller.rb b/app/controllers/hyrax/cdls_controller.rb index d298641..5e0b274 100644 --- a/app/controllers/hyrax/cdls_controller.rb +++ b/app/controllers/hyrax/cdls_controller.rb @@ -5,8 +5,13 @@ module Hyrax class CdlsController < ApplicationController # Adds Hyrax behaviors to the controller. include Hyrax::WorksControllerBehavior + include Hyku::WorksControllerBehavior include Hyrax::BreadcrumbsForWorks - self.curation_concern_type = ::Cdl + self.curation_concern_type = ::CdlResource + + # Use a Valkyrie aware form service to generate Valkyrie::ChangeSet style + # forms. + self.work_form_service = Hyrax::FormFactory.new # Use this line if you want to use a custom presenter self.show_presenter = Hyrax::CdlPresenter diff --git a/app/controllers/hyrax/etds_controller.rb b/app/controllers/hyrax/etds_controller.rb index e0d3776..6cfb806 100644 --- a/app/controllers/hyrax/etds_controller.rb +++ b/app/controllers/hyrax/etds_controller.rb @@ -5,8 +5,13 @@ module Hyrax class EtdsController < ApplicationController # Adds Hyrax behaviors to the controller. include Hyrax::WorksControllerBehavior + include Hyku::WorksControllerBehavior include Hyrax::BreadcrumbsForWorks - self.curation_concern_type = ::Etd + self.curation_concern_type = ::EtdResource + + # Use a Valkyrie aware form service to generate Valkyrie::ChangeSet style + # forms. + self.work_form_service = Hyrax::FormFactory.new # Use this line if you want to use a custom presenter self.show_presenter = Hyrax::EtdPresenter diff --git a/app/controllers/hyrax/oers_controller.rb b/app/controllers/hyrax/oers_controller.rb index 20d66c1..ea4879c 100644 --- a/app/controllers/hyrax/oers_controller.rb +++ b/app/controllers/hyrax/oers_controller.rb @@ -5,8 +5,13 @@ module Hyrax class OersController < ApplicationController # Adds Hyrax behaviors to the controller. include Hyrax::WorksControllerBehavior + include Hyku::WorksControllerBehavior include Hyrax::BreadcrumbsForWorks - self.curation_concern_type = ::Oer + self.curation_concern_type = ::OerResource + + # Use a Valkyrie aware form service to generate Valkyrie::ChangeSet style + # forms. + self.work_form_service = Hyrax::FormFactory.new # Use this line if you want to use a custom presenter self.show_presenter = Hyrax::OerPresenter diff --git a/app/forms/cdl_resource_form.rb b/app/forms/cdl_resource_form.rb new file mode 100644 index 0000000..b2bcccd --- /dev/null +++ b/app/forms/cdl_resource_form.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource CdlResource` +# +# @see https://github.com/samvera/hyrax/wiki/Hyrax-Valkyrie-Usage-Guide#forms +# @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking +class CdlResourceForm < Hyrax::Forms::ResourceForm(CdlResource) + # include Hyrax::FormFields(:basic_metadata) + include Hyrax::FormFields(:cdl_resource) + include Hyrax::FormFields(:with_pdf_viewer) + include Hyrax::FormFields(:with_video_embed) + + # Define custom form fields using the Valkyrie::ChangeSet interface + # + # property :my_custom_form_field + + # if you want a field in the form, but it doesn't have a directly corresponding + # model attribute, make it virtual + # + # property :user_input_not_destined_for_the_model, virtual: true +end diff --git a/app/forms/etd_resource_form.rb b/app/forms/etd_resource_form.rb new file mode 100644 index 0000000..4838446 --- /dev/null +++ b/app/forms/etd_resource_form.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource EtdResource` +# +# @see https://github.com/samvera/hyrax/wiki/Hyrax-Valkyrie-Usage-Guide#forms +# @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking +class EtdResourceForm < Hyrax::Forms::ResourceForm(EtdResource) + # Commented out basic_metadata because these terms were added to etd_resource so we can customize it. + # include Hyrax::FormFields(:basic_metadata) + include Hyrax::FormFields(:etd_resource) + include Hyrax::FormFields(:with_pdf_viewer) + include Hyrax::FormFields(:with_video_embed) + include VideoEmbedBehavior::Validation + # Define custom form fields using the Valkyrie::ChangeSet interface + # + # property :my_custom_form_field + + # if you want a field in the form, but it doesn't have a directly corresponding + # model attribute, make it virtual + # + # property :user_input_not_destined_for_the_model, virtual: true +end diff --git a/app/forms/oer_resource_form.rb b/app/forms/oer_resource_form.rb new file mode 100644 index 0000000..0efe325 --- /dev/null +++ b/app/forms/oer_resource_form.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource OerResource` +# +# @see https://github.com/samvera/hyrax/wiki/Hyrax-Valkyrie-Usage-Guide#forms +# @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking +class OerResourceForm < Hyrax::Forms::ResourceForm(OerResource) + # Commented out basic_metadata because these terms were added to etd_resource so we can customize it. + # include Hyrax::FormFields(:basic_metadata) + include Hyrax::FormFields(:oer_resource) + include Hyrax::FormFields(:with_pdf_viewer) + include Hyrax::FormFields(:with_video_embed) + include VideoEmbedBehavior::Validation + # Define custom form fields using the Valkyrie::ChangeSet interface + # + # property :my_custom_form_field + + # if you want a field in the form, but it doesn't have a directly corresponding + # model attribute, make it virtual + # + # property :user_input_not_destined_for_the_model, virtual: true + + delegate :related_members_attributes=, :previous_version, :newer_version, :alternate_version, :related_item, + :previous_version_id, :newer_version_id, :alternate_version_id, :related_item_id, to: :model + + def self.build_permitted_params + super + [ + { + related_members_attributes: %i[id _destroy relationship] + } + ] + end + + def previous_version_json + return unless previous_version.present? + + previous_version.map do |child| + { + id: child.id, + label: child.to_s, + path: @controller.url_for(child), + relationship: "previous-version" + } + end.to_json + end + + def newer_version_json + return unless newer_version.present? + + newer_version.map do |child| + { + id: child.id, + label: child.to_s, + path: @controller.url_for(child), + relationship: "newer-version" + } + end.to_json + end + + def alternate_version_json + return unless alternate_version.present? + + alternate_version.map do |child| + { + id: child.id, + label: child.to_s, + path: @controller.url_for(child), + relationship: "alternate-version" + } + end.to_json + end + + def related_item_json + return unless related_item.present? + + related_item.map do |child| + { + id: child.id, + label: child.to_s, + path: @controller.url_for(child), + relationship: "related-item" + } + end.to_json + end +end diff --git a/app/helpers/hyrax/override_helper_behavior.rb b/app/helpers/hyrax/override_helper_behavior.rb index e1717a9..34309b3 100644 --- a/app/helpers/hyrax/override_helper_behavior.rb +++ b/app/helpers/hyrax/override_helper_behavior.rb @@ -49,7 +49,7 @@ def truncate_and_iconify_auto_link(field, show_link = true) # this block is only executed when a link is inserted; # if we pass text containing no links, it just returns text. auto_link(html_escape(text)) do |value| - "#{(' ' + value) if show_link}" + "#{(' ' + value) if show_link}" end text.truncate(230, separator: ' ') end diff --git a/app/indexers/cdl_indexer.rb b/app/indexers/cdl_indexer.rb index 88f0a23..d2c0b4f 100644 --- a/app/indexers/cdl_indexer.rb +++ b/app/indexers/cdl_indexer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Generated via # `rails generate hyrax:work Cdl` class CdlIndexer < AppIndexer diff --git a/app/indexers/cdl_resource_indexer.rb b/app/indexers/cdl_resource_indexer.rb new file mode 100644 index 0000000..4ef7488 --- /dev/null +++ b/app/indexers/cdl_resource_indexer.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource CdlResource` +class CdlResourceIndexer < Hyrax::ValkyrieWorkIndexer + include Hyrax::Indexer(:basic_metadata) + include Hyrax::Indexer(:cdl_resource) + + include HykuIndexing + + # Uncomment this block if you want to add custom indexing behavior: + # def to_solr + # super.tap do |index_document| + # index_document[:my_field_tesim] = resource.my_field.map(&:to_s) + # index_document[:other_field_ssim] = resource.other_field + # end + # end +end diff --git a/app/indexers/etd_resource_indexer.rb b/app/indexers/etd_resource_indexer.rb index 5c4580e..cb0ae1d 100644 --- a/app/indexers/etd_resource_indexer.rb +++ b/app/indexers/etd_resource_indexer.rb @@ -1,22 +1,16 @@ # frozen_string_literal: true - -# TODO: temporarily added to see if iiif print engine spec error would resolve. (it did) -# so some of the spec failures is because the models haven't been -# valkyrized - # Generated via -# `rails generate hyrax:work_resource GenericWorkResource` +# `rails generate hyrax:work_resource EtdResource` class EtdResourceIndexer < Hyrax::ValkyrieWorkIndexer - # TODO: specify custom properties for this work type - - # include Hyrax::Indexer(:basic_metadata) - # include Hyrax::Indexer(:bulkrax_metadata) - # include Hyrax::Indexer(:generic_work_resource) - # include Hyrax::Indexer(:with_pdf_viewer) - # include Hyrax::Indexer(:with_video_embed) + include Hyrax::Indexer(:basic_metadata) + include Hyrax::Indexer(:bulkrax_metadata) + include Hyrax::Indexer(:etd_resource) + include Hyrax::Indexer(:with_pdf_viewer) + include Hyrax::Indexer(:with_video_embed) include HykuIndexing + # Uncomment this block if you want to add custom indexing behavior: # def to_solr # super.tap do |index_document| @@ -24,4 +18,4 @@ class EtdResourceIndexer < Hyrax::ValkyrieWorkIndexer # index_document[:other_field_ssim] = resource.other_field # end # end -end \ No newline at end of file +end diff --git a/app/indexers/oer_resource_indexer.rb b/app/indexers/oer_resource_indexer.rb new file mode 100644 index 0000000..3ed693c --- /dev/null +++ b/app/indexers/oer_resource_indexer.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource OerResource` +class OerResourceIndexer < Hyrax::ValkyrieWorkIndexer + include Hyrax::Indexer(:basic_metadata) + include Hyrax::Indexer(:bulkrax_metadata) + include Hyrax::Indexer(:oer_resource) + include Hyrax::Indexer(:with_pdf_viewer) + include Hyrax::Indexer(:with_video_embed) + + include HykuIndexing + + # Uncomment this block if you want to add custom indexing behavior: + # def to_solr + # super.tap do |index_document| + # index_document[:my_field_tesim] = resource.my_field.map(&:to_s) + # index_document[:other_field_ssim] = resource.other_field + # end + # end +end diff --git a/app/jobs/create_group_and_add_members_job.rb b/app/jobs/create_group_and_add_members_job.rb index 53503a1..9211141 100644 --- a/app/jobs/create_group_and_add_members_job.rb +++ b/app/jobs/create_group_and_add_members_job.rb @@ -13,10 +13,10 @@ class CreateGroupAndAddMembersJob < ApplicationJob queue_as :default def perform(cdl_id, retries = 0) - work = Cdl.where(id: cdl_id).first + work = Hyrax.query_service.find_by(id: cdl_id) return if work.nil? - page_count = work.file_sets.first.page_count.first.to_i + page_count = work.members.first.original_file.page_count.first.to_i child_model = work.iiif_print_config.pdf_split_child_model child_works_count = work.members.select { |member| member.is_a?(child_model) }.count @@ -28,7 +28,7 @@ def perform(cdl_id, retries = 0) assign_read_groups(member, group.name) end - work.save + Hyrax.persister.save(resource: work) group.save else return if retries > RETRY_MAX @@ -42,7 +42,7 @@ def perform(cdl_id, retries = 0) def assign_read_groups(member, group_name) member.read_groups = [group_name] - member.save + Hyrax.persister.save(resource: member) member.members.each do |sub_member| assign_read_groups(sub_member, group_name) end diff --git a/app/jobs/destroy_cdl_group_job.rb b/app/jobs/destroy_cdl_group_job.rb index ddb9115..29d0204 100644 --- a/app/jobs/destroy_cdl_group_job.rb +++ b/app/jobs/destroy_cdl_group_job.rb @@ -1,5 +1,9 @@ # frozen_string_literal: true +# Probably not needed because we're only going to ever +# be destroying one group so a background job is unnecessary. +# Leaving it here for now because the Cdl model still references it. +# But in Valkyrie, we're going to just destroy the group in the Listener. class DestroyCdlGroupJob < ApplicationJob queue_as :default diff --git a/app/jobs/iiif_print/create_relationships_job_decorator.rb b/app/jobs/iiif_print/create_relationships_job_decorator.rb index 0141351..c56e4b9 100644 --- a/app/jobs/iiif_print/create_relationships_job_decorator.rb +++ b/app/jobs/iiif_print/create_relationships_job_decorator.rb @@ -34,7 +34,7 @@ def perform(parent_id:, parent_model:, child_model:, retries: 0, **) # report failures & keep pending relationships raise "CreateRelationshipsJob failed for parent id: #{@parent_id} " \ "had #{@number_of_successes} successes & #{@number_of_failures} failures, " \ - "with errors: #{@errors}. Wanted #{@pending_children} children." + "with errors: #{@errors}. Wanted #{@pending_children.count} children." end # OVERRIDE begin diff --git a/app/models/cdl_resource.rb b/app/models/cdl_resource.rb new file mode 100644 index 0000000..bd29638 --- /dev/null +++ b/app/models/cdl_resource.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource CdlResource` +class CdlResource < Hyrax::Work + # Commented out basic_metadata because these terms were added to etd_resource so we can customize it. + # include Hyrax::Schema(:basic_metadata) + include Hyrax::Schema(:cdl_resource) + include Hyrax::Schema(:bulkrax_metadata) + include Hyrax::Schema(:with_pdf_viewer) + include Hyrax::Schema(:with_video_embed) + include Hyrax::ArResource + include Hyrax::NestedWorks + + Hyrax::ValkyrieLazyMigration.migrating(self, from: Cdl) + + include IiifPrint.model_configuration( + pdf_split_child_model: GenericWorkResource, + pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter + ) + + prepend OrderAlready.for(:creator) +end diff --git a/app/models/etd_resource.rb b/app/models/etd_resource.rb new file mode 100644 index 0000000..27b4294 --- /dev/null +++ b/app/models/etd_resource.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource EtdResource` +class EtdResource < Hyrax::Work + # Commented out basic_metadata because these terms were added to etd_resource so we can customize it. + # include Hyrax::Schema(:basic_metadata) + include Hyrax::Schema(:etd_resource) + include Hyrax::Schema(:bulkrax_metadata) + include Hyrax::Schema(:with_pdf_viewer) + include Hyrax::Schema(:with_video_embed) + include Hyrax::ArResource + include Hyrax::NestedWorks + + Hyrax::ValkyrieLazyMigration.migrating(self, from: Etd) + + include IiifPrint.model_configuration( + pdf_split_child_model: GenericWorkResource, + pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter + ) + + prepend OrderAlready.for(:creator) +end diff --git a/app/models/oer_resource.rb b/app/models/oer_resource.rb new file mode 100644 index 0000000..ea6e0b7 --- /dev/null +++ b/app/models/oer_resource.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource OerResource` +class OerResource < Hyrax::Work + # Commented out basic_metadata because these terms were added to etd_resource so we can customize it. + # include Hyrax::Schema(:basic_metadata) + include Hyrax::Schema(:oer_resource) + include Hyrax::Schema(:bulkrax_metadata) + include Hyrax::Schema(:with_pdf_viewer) + include Hyrax::Schema(:with_video_embed) + include Hyrax::ArResource + include Hyrax::NestedWorks + + Hyrax::ValkyrieLazyMigration.migrating(self, from: Oer) + + include IiifPrint.model_configuration( + pdf_split_child_model: GenericWorkResource, + pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter + ) + + prepend OrderAlready.for(:creator) + + def previous_version + @previous_version ||= Hyrax.query_service.find_by(id: previous_version_id) if previous_version_id.present? + end + + def newer_version + @newer_version ||= Hyrax.query_service.find_by(id: newer_version_id) if newer_version_id.present? + end + + def alternate_version + @alternate_version ||= Hyrax.query_service.find_by(id: alternate_version_id) if alternate_version_id.present? + end + + def related_item + @related_item ||= Hyrax.query_service.find_by(id: related_item_id) if related_item_id.present? + end +end diff --git a/app/services/hyku_knapsack/active_fedora_property_locator.rb b/app/services/hyku_knapsack/active_fedora_property_locator.rb new file mode 100644 index 0000000..21fd87c --- /dev/null +++ b/app/services/hyku_knapsack/active_fedora_property_locator.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +module HykuKnapsack + class ActiveFedoraPropertyLocator + attr_reader :klass, :properties + + def initialize(klass) + @klass = klass + locate + generate_dynamic_methods + end + + def from_app + properties.select { |_k, file_path| from_root?(file_path) } + end + + def from_gems + properties.reject { |_k, file_path| from_root?(file_path) } + end + + private + + # @return [Hash] a hash of property names and their file paths (with line numbers) + # @example + # {:has_model=>"/usr/local/bundle/gems/active-fedora-14.0.1/lib/active_fedora/fedora_attributes.rb:15", + # :create_date=>"/usr/local/bundle/gems/active-fedora-14.0.1/lib/active_fedora/fedora_attributes.rb:16"} + def locate + @properties ||= klass.properties.keys.map(&:to_sym).index_with do |property_name| + find_property_definition(klass, property_name) + end + end + + def find_property_definition(klass, property_name) + klass.ancestors.each do |ancestor| + next unless ancestor.name # Skip anonymous modules + file_path, _line_num = Object.const_source_location(ancestor.name) + next unless file_path + + File.read(file_path).force_encoding("UTF-8").scrub.each_line.with_index do |line, line_num| + return "#{file_path}:#{line_num + 1}" if match_property_definition?(line, property_name) + end + end + + nil + end + + def match_property_definition?(line, property_name) + # TODO: If we get a nil as a file_path then we need to improve the regexp + regexp = /^\s*(property|[\w.]+\.property)\s*\(?\s*:\s*#{property_name}\b/ + !line.strip.start_with?('#') && line.match?(regexp) # Skip commented lines + end + + def from_root?(file_path) + file_path.starts_with?(HykuKnapsack::Engine.root.to_s) || file_path.starts_with?(Rails.root.to_s) + end + + def generate_dynamic_methods + method_suffixes = properties.values.each_with_object([]) do |file_path, arr| + next unless file_path + suffix = file_path.split('/').last.split('.').first + arr << suffix unless arr.include?(suffix) + end + + method_suffixes.each do |suffix| + self.class.define_method("from_#{suffix}") do + properties.select { |_k, file_path| file_path.split('.rb').first.include?(suffix) } + end + end + end + end +end diff --git a/app/services/hyrax/simple_schema_loader_decorator.rb b/app/services/hyrax/simple_schema_loader_decorator.rb index 07adc3b..413e44c 100644 --- a/app/services/hyrax/simple_schema_loader_decorator.rb +++ b/app/services/hyrax/simple_schema_loader_decorator.rb @@ -5,7 +5,7 @@ module Hyrax module SimpleSchemaLoaderDecorator def config_search_paths - super + [HykuKnapsack::Engine.root] + [HykuKnapsack::Engine.root] + super end end end diff --git a/app/services/listeners/cdl_listener.rb b/app/services/listeners/cdl_listener.rb new file mode 100644 index 0000000..d395e13 --- /dev/null +++ b/app/services/listeners/cdl_listener.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Listeners + class CdlListener + def on_object_deleted(event) + object = event[:object] + return unless object.is_a?(CdlResource) + + id = object.id + Hyrax::Group.find_by(name: id)&.destroy + end + end +end diff --git a/app/views/hyrax/cdl_resources/_cdl_resource.html.erb b/app/views/hyrax/cdl_resources/_cdl_resource.html.erb new file mode 100644 index 0000000..dfa344b --- /dev/null +++ b/app/views/hyrax/cdl_resources/_cdl_resource.html.erb @@ -0,0 +1,2 @@ +<%# This is a search result view %> +<%= render 'catalog/document', document: cdl_resource, document_counter: cdl_resource_counter %> diff --git a/app/views/hyrax/etd_resources/_etd_resource.html.erb b/app/views/hyrax/etd_resources/_etd_resource.html.erb new file mode 100644 index 0000000..f71dd2d --- /dev/null +++ b/app/views/hyrax/etd_resources/_etd_resource.html.erb @@ -0,0 +1,2 @@ +<%# This is a search result view %> +<%= render 'catalog/document', document: etd_resource, document_counter: etd_resource_counter %> diff --git a/app/views/hyrax/oer_resources/_oer_resource.html.erb b/app/views/hyrax/oer_resources/_oer_resource.html.erb new file mode 100644 index 0000000..53ae27d --- /dev/null +++ b/app/views/hyrax/oer_resources/_oer_resource.html.erb @@ -0,0 +1,2 @@ +<%# This is a search result view %> +<%= render 'catalog/document', document: oer_resource, document_counter: oer_resource_counter %> diff --git a/app/views/hyrax/oers/_related_items.html.erb b/app/views/hyrax/oers/_related_items.html.erb index bf9c2e1..551c12a 100644 --- a/app/views/hyrax/oers/_related_items.html.erb +++ b/app/views/hyrax/oers/_related_items.html.erb @@ -1,7 +1,7 @@ -<% previous_members = presenter.member_presenters_for(presenter.previous_versions) %> -<% newer_members = presenter.member_presenters_for(presenter.newer_versions) %> -<% alternate_members = presenter.member_presenters_for(presenter.alternate_versions) %> -<% related_items = presenter.member_presenters_for(presenter.related_items) %> +<% previous_members = presenter.member_presenters(presenter.previous_versions) %> +<% newer_members = presenter.member_presenters(presenter.newer_versions) %> +<% alternate_members = presenter.member_presenters(presenter.alternate_versions) %> +<% related_items = presenter.member_presenters(presenter.related_items) %> <% if previous_members.present? || newer_members.present? || alternate_members.present? || related_items.present? %>

<%= t('hyrax.oer.show.related_items') %>

diff --git a/app/views/records/edit_fields/_table_of_contents.html.erb b/app/views/records/edit_fields/_table_of_contents.html.erb index 9b631ac..c71ce2c 100644 --- a/app/views/records/edit_fields/_table_of_contents.html.erb +++ b/app/views/records/edit_fields/_table_of_contents.html.erb @@ -1,6 +1,5 @@ -<% if curation_concern.class == Oer %> +<% if curation_concern.to_rdf_representation == 'Oer' %> <%= f.input :table_of_contents, as: :multi_value, - label: t("hyrax.oer.labels.table_of_contents"), hint: t("hyrax.oer.hints.table_of_contents"), input_html: { rows: '14', type: 'textarea'}, required: f.object.required?(key) %> <% end %> diff --git a/app/views/themes/cultural_show/hyrax/oers/_related_items.html.erb b/app/views/themes/cultural_show/hyrax/oers/_related_items.html.erb index b38bf49..bfdfa4a 100644 --- a/app/views/themes/cultural_show/hyrax/oers/_related_items.html.erb +++ b/app/views/themes/cultural_show/hyrax/oers/_related_items.html.erb @@ -1,7 +1,7 @@ -<% previous_members = presenter.member_presenters_for(presenter.previous_versions) %> -<% newer_members = presenter.member_presenters_for(presenter.newer_versions) %> -<% alternate_members = presenter.member_presenters_for(presenter.alternate_versions) %> -<% related_items = presenter.member_presenters_for(presenter.related_items) %> +<% previous_members = presenter.member_presenters(presenter.previous_versions) %> +<% newer_members = presenter.member_presenters(presenter.newer_versions) %> +<% alternate_members = presenter.member_presenters(presenter.alternate_versions) %> +<% related_items = presenter.member_presenters(presenter.related_items) %> <% if previous_members.present? || newer_members.present? || alternate_members.present? || related_items.present? %>

<%= t('hyrax.oer.show.related_items') %>

@@ -26,4 +26,3 @@ <% end %> <% end %> - diff --git a/config/initializers/hyku_knapsack_listeners.rb b/config/initializers/hyku_knapsack_listeners.rb new file mode 100644 index 0000000..198b02d --- /dev/null +++ b/config/initializers/hyku_knapsack_listeners.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +Hyrax.publisher.subscribe(Listeners::CdlListener.new) diff --git a/config/initializers/hyrax.rb b/config/initializers/hyrax.rb index 4f98894..d3f66f9 100644 --- a/config/initializers/hyrax.rb +++ b/config/initializers/hyrax.rb @@ -4,11 +4,11 @@ Hyrax.config do |config| # TODO: Valkyrize models and update this initializer # Injected via `rails g hyrax:work Oer` - # config.register_curation_concern :oer + config.register_curation_concern :oer # Injected via `rails g hyrax:work Etd` config.register_curation_concern :etd # # Injected via `rails g hyrax:work Cdl` - # config.register_curation_concern :cdl + config.register_curation_concern :cdl # # See https://github.com/scientist-softserv/adventist-dl/issues/183 # # Also, we will continue to extract txt file's text using Adventist::TextFileTextExtractionService diff --git a/config/initializers/wings.rb b/config/initializers/wings.rb new file mode 100644 index 0000000..e4cb9d4 --- /dev/null +++ b/config/initializers/wings.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true +# rubocop:disable Metrics/BlockLength + +Rails.application.config.after_initialize do + # Add all concerns that are migrating from ActiveFedora here + CONCERNS = [Cdl, Etd, GenericWork, Image, Oer] + + CONCERNS.each do |klass| + Wings::ModelRegistry.register("#{klass}Resource".constantize, klass) + # we register itself so we can pre-translate the class in Freyja instead of having to translate in each query_service + Wings::ModelRegistry.register(klass, klass) + end + + Wings::ModelRegistry.register(CdlResource, Cdl) + Wings::ModelRegistry.register(EtdResource, Etd) + Wings::ModelRegistry.register(GenericWorkResource, GenericWork) + Wings::ModelRegistry.register(ImageResource, Image) + Wings::ModelRegistry.register(OerResource, Oer) + + Valkyrie.config.resource_class_resolver = lambda do |resource_klass_name| + # TODO: Can we use some kind of lookup. + klass_name = resource_klass_name.gsub(/Resource$/, '') + if CONCERNS.map(&:to_s).include?(klass_name) + "#{klass_name}Resource".constantize + elsif 'Collection' == klass_name + CollectionResource + elsif 'AdminSet' == klass_name + AdminSetResource + # Without this mapping, we'll see cases of Postgres Valkyrie adapter attempting to write to + # Fedora. Yeah! + elsif 'Hydra::AccessControl' == klass_name + Hyrax::AccessControl + elsif 'FileSet' == klass_name + Hyrax::FileSet + elsif 'Hydra::AccessControls::Embargo' == klass_name + Hyrax::Embargo + elsif 'Hydra::AccessControls::Lease' == klass_name + Hyrax::Lease + elsif 'Hydra::PCDM::File' == klass_name + Hyrax::FileMetadata + else + klass_name.constantize + end + end +end +# rubocop:enable Metrics/BlockLength diff --git a/config/locales/hyrax.en.yml b/config/locales/hyrax.en.yml index 82b1786..2e253c1 100644 --- a/config/locales/hyrax.en.yml +++ b/config/locales/hyrax.en.yml @@ -1212,4 +1212,4 @@ en: find_child_work: Search for a work… member_of_collection_ids: Select a collection… required: - html: required \ No newline at end of file + html: required diff --git a/config/locales/locales/hyrax.de.yml b/config/locales/locales/hyrax.de.yml index b1ed408..daab142 100644 --- a/config/locales/locales/hyrax.de.yml +++ b/config/locales/locales/hyrax.de.yml @@ -1211,4 +1211,4 @@ de: find_child_work: Suche nach einer Arbeit… member_of_collection_ids: Sammlung auswählen… required: - html: erforderlich + html: erforderlich diff --git a/config/locales/locales/hyrax.en.yml b/config/locales/locales/hyrax.en.yml index d862ca1..10b783d 100644 --- a/config/locales/locales/hyrax.en.yml +++ b/config/locales/locales/hyrax.en.yml @@ -1216,4 +1216,4 @@ en: find_child_work: Search for a work… member_of_collection_ids: Select a collection… required: - html: required + html: required diff --git a/config/locales/locales/hyrax.es.yml b/config/locales/locales/hyrax.es.yml index 26e1354..f98966c 100644 --- a/config/locales/locales/hyrax.es.yml +++ b/config/locales/locales/hyrax.es.yml @@ -1212,4 +1212,4 @@ es: find_child_work: Busca trabajo ... member_of_collection_ids: Seleccione una colección ... required: - html: necesario + html: necesario diff --git a/config/locales/locales/hyrax.fr.yml b/config/locales/locales/hyrax.fr.yml index 828f8b3..c59b384 100644 --- a/config/locales/locales/hyrax.fr.yml +++ b/config/locales/locales/hyrax.fr.yml @@ -1212,4 +1212,4 @@ fr: find_child_work: Rechercher une œuvre… member_of_collection_ids: Sélectionnez une collection… required: - html: obligatoire + html: obligatoire diff --git a/config/locales/locales/hyrax.it.yml b/config/locales/locales/hyrax.it.yml index a329f20..755c8fd 100644 --- a/config/locales/locales/hyrax.it.yml +++ b/config/locales/locales/hyrax.it.yml @@ -1212,4 +1212,4 @@ it: find_child_work: Cerca un'opera ... member_of_collection_ids: Seleziona una collezione ... required: - html: necessario + html: necessario diff --git a/config/locales/locales/hyrax.pt-BR.yml b/config/locales/locales/hyrax.pt-BR.yml index 87d3196..9026a97 100644 --- a/config/locales/locales/hyrax.pt-BR.yml +++ b/config/locales/locales/hyrax.pt-BR.yml @@ -1212,4 +1212,4 @@ pt-BR: find_child_work: Procure um trabalho… member_of_collection_ids: Selecione uma coleção… required: - html: requeridos + html: requeridos diff --git a/config/locales/locales/hyrax.zh.yml b/config/locales/locales/hyrax.zh.yml index a59edcd..624a478 100644 --- a/config/locales/locales/hyrax.zh.yml +++ b/config/locales/locales/hyrax.zh.yml @@ -1212,4 +1212,4 @@ zh: find_child_work: 正在搜寻作品… member_of_collection_ids: 选择一个收藏夹… required: - html: 需要 + html: 需要 diff --git a/config/metadata/basic_metadata.yaml b/config/metadata/basic_metadata.yaml new file mode 100644 index 0000000..47fdc51 --- /dev/null +++ b/config/metadata/basic_metadata.yaml @@ -0,0 +1,5 @@ +# This file is blank to override base Hyku +# Each model will have its own model resource metadata.yaml +# that includes basic metadata for more customizations + +attributes: {} \ No newline at end of file diff --git a/config/metadata/bulkrax_metadata.yaml b/config/metadata/bulkrax_metadata.yaml new file mode 100644 index 0000000..61d66e7 --- /dev/null +++ b/config/metadata/bulkrax_metadata.yaml @@ -0,0 +1,14 @@ +attributes: + bulkrax_identifier: + type: string + predicate: https://hykucommons.org/terms/bulkrax_identifier + multiple: false + index_keys: + # NOTE: For backwards compatibility, we specify `bulkrax_identifier_tesim` + # however if we want singular (which we do) and to have exact match + # (which we do) we don't want to use Text English Stored Indexed + # Multiple (e.g. _tesim suffix). Instead we want String Stored + # Index (e.g. _ssi). However, until we get all of our efforts + # coordinated; we'll continue to contend with this misalignment. + - "bulkrax_identifier_tesim" + - "bulkrax_identifier_ssi" diff --git a/config/metadata/cdl_resource.yaml b/config/metadata/cdl_resource.yaml new file mode 100644 index 0000000..a4add70 --- /dev/null +++ b/config/metadata/cdl_resource.yaml @@ -0,0 +1,264 @@ +# Simple yaml config-driven schema which is used to define model attributes, +# index key names, and form properties. +# +# Attributes must have a type but all other configuration options are optional. +# Please note: If using Valkyrie's Fedora Metadata Adapter, predicates for attributes +# must be placed here. +# +# attributes: +# attribute_name: +# type: string +# multiple: false +# index_keys: +# - "attribute_name_sim" +# form: +# required: true +# primary: true +# multiple: false +# +# @see config/metadata/basic_metadata.yaml for an example configuration +# +# Generated via +# `rails generate hyrax:work_resource CdlResource` + +attributes: + creator: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "creator_sim" + - "creator_tesim" + predicate: http://purl.org/dc/elements/1.1/creator + keyword: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "keyword_sim" + - "keyword_tesim" + predicate: http://schema.org/keywords + resource_type: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "resource_type_sim" + - "resource_type_tesim" + predicate: http://purl.org/dc/terms/type + rights_statement: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "rights_statement_sim" + - "rights_statement_tesim" + predicate: http://www.europeana.eu/schemas/edm/rights + license: + type: string + multiple: true + form: + primary: false + index_keys: + - "license_sim" + - "license_tesim" + predicate: http://purl.org/dc/terms/license + abstract: + type: string + multiple: true + form: + primary: false + index_keys: + - "abstract_sim" + - "abstract_tesim" + predicate: http://purl.org/dc/terms/abstract + access_right: + type: string + multiple: true + form: + primary: false + index_keys: + - "access_right_sim" + - "access_right_tesim" + predicate: http://purl.org/dc/terms/accessRights + additional_information: + type: string + predicate: http://purl.org/dc/terms/accessRights + multiple: true + form: + primary: false + index_keys: + - "additional_information_tesim" + admin_note: + type: string + form: + primary: false + predicate: http://schema.org/positiveNotes + multiple: false + index_keys: + - "admin_note_tesim" + alternative_title: + type: string + multiple: true + form: + primary: false + index_keys: + - "alternative_title_sim" + - "alternative_title_tesim" + predicate: http://purl.org/dc/terms/alternative + bibliographic_citation: + type: string + predicate: http://purl.org/dc/terms/bibliographicCitation + multiple: true + form: + primary: false + index_keys: + - "bibliographic_citation_tesim" + chronology_note: + type: string + predicate: https://hykucommons.org/terms/chronology_note + multiple: true + form: + primary: false + index_keys: + - "chronology_note_tesim" + - "chronology_note_sim" + contributing_library: + type: string + predicate: https://hykucommons.org/terms/contributing_library + multiple: true + form: + primary: false + index_keys: + - "contributing_library_tesim" + - "contributing_library_sim" + contributor: + type: string + multiple: true + form: + primary: false + index_keys: + - "contributor_tesim" + - "contributor_sim" + predicate: http://purl.org/dc/elements/1.1/contributor + date_created: + type: date_time + multiple: true + form: + primary: false + index_keys: + - "date_created_sim" + - "date_created_tesim" + predicate: http://purl.org/dc/terms/created + description: + type: string + multiple: true + form: + primary: false + index_keys: + - "description_sim" + - "description_tesim" + predicate: http://purl.org/dc/elements/1.1/description + identifier: + type: string + multiple: true + form: + primary: false + index_keys: + - "identifier_sim" + - "identifier_tesim" + predicate: http://purl.org/dc/terms/identifier + language: + type: string + multiple: true + form: + primary: false + index_keys: + - "language_sim" + - "language_tesim" + predicate: http://purl.org/dc/elements/1.1/language + library_catalog_identifier: + type: string + predicate: https://hykucommons.org/terms/library_catalog_identifier + multiple: true + form: + primary: false + index_keys: + - "library_catalog_identifier_tesim" + - "library_catalog_identifier_sim" + publisher: + type: string + multiple: true + form: + primary: false + index_keys: + - "publisher_sim" + - "publisher_tesim" + predicate: http://purl.org/dc/elements/1.1/publisher + related_url: + type: string + multiple: true + form: + primary: false + index_keys: + - "related_url_sim" + - "related_url_tesim" + predicate: http://www.w3.org/2000/01/rdf-schema#seeAlso + rights_notes: + type: string + multiple: true + form: + primary: false + index_keys: + - "rights_notes_sim" + - "rights_notes_tesim" + predicate: http://purl.org/dc/elements/1.1/rights + source: + type: string + multiple: true + form: + primary: false + index_keys: + - "source_sim" + - "source_tesim" + predicate: http://purl.org/dc/terms/source + subject: + type: string + multiple: true + index_keys: + - "subject_sim" + - "subject_tesim" + form: + primary: false + predicate: http://purl.org/dc/elements/1.1/subject + arkivo_checksum: + type: string + multiple: false + predicate: http://scholarsphere.psu.edu/ns#arkivoChecksum + based_near: + type: string + multiple: true + index_keys: + - "based_near_sim" + - "based_near_tesim" + predicate: http://xmlns.com/foaf/0.1/based_near + import_url: + type: string + predicate: http://scholarsphere.psu.edu/ns#importUrl + label: + type: string + index_keys: + - "label_sim" + - "label_tesim" + predicate: info:fedora/fedora-system:def/model#downloadFilename + relative_path: + type: string + predicate: http://scholarsphere.psu.edu/ns#relativePath diff --git a/config/metadata/collection_resource.yaml b/config/metadata/collection_resource.yaml new file mode 100644 index 0000000..a1fba95 --- /dev/null +++ b/config/metadata/collection_resource.yaml @@ -0,0 +1,227 @@ +# Simple yaml config-driven schema which is used to define model attributes, +# index key names, and form properties. +# +# Attributes must have a type but all other configuration options are optional. +# Please note: If using Valkyrie's Fedora Metadata Adapter, predicates for attributes +# must be placed here. +# +# attributes: +# attribute_name: +# type: string +# multiple: false +# index_keys: +# - "attribute_name_sim" +# form: +# required: true +# primary: true +# multiple: false +# +# @see config/metadata/basic_metadata.yaml for an example configuration +# +# Generated via +# `rails generate hyrax:collection_resource CollectionResource` + +# This is a copy of the basic_metadata.yaml because we override basic_metadata.yaml and making it. +# We do this because we are grouping everything into the *_resource.yaml for more customizations. +attributes: + abstract: + type: string + multiple: true + form: + primary: false + index_keys: + - "abstract_sim" + - "abstract_tesim" + predicate: http://purl.org/dc/terms/abstract + access_right: + type: string + multiple: true + form: + primary: false + index_keys: + - "access_right_sim" + - "access_right_tesim" + predicate: http://purl.org/dc/terms/accessRights + alternative_title: + type: string + multiple: true + form: + primary: false + index_keys: + - "alternative_title_sim" + - "alternative_title_tesim" + predicate: http://purl.org/dc/terms/alternative + arkivo_checksum: + type: string + multiple: false + form: + primary: false + predicate: http://scholarsphere.psu.edu/ns#arkivoChecksum + based_near: + type: string + multiple: true + form: + primary: false + index_keys: + - "based_near_sim" + - "based_near_tesim" + predicate: http://xmlns.com/foaf/0.1/based_near + bibliographic_citation: + type: string + multiple: true + form: + primary: false + index_keys: + - "bibliographic_citation_sim" + - "bibliographic_citation_tesim" + predicate: http://purl.org/dc/terms/bibliographicCitation + contributor: + type: string + multiple: true + form: + primary: false + index_keys: + - "contributor_tesim" + - "contributor_sim" + predicate: http://purl.org/dc/elements/1.1/contributor + creator: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "creator_sim" + - "creator_tesim" + predicate: http://purl.org/dc/elements/1.1/creator + date_created: + type: date_time + multiple: true + form: + primary: false + index_keys: + - "date_created_sim" + - "date_created_tesim" + predicate: http://purl.org/dc/terms/created + description: + type: string + multiple: true + form: + primary: false + index_keys: + - "description_sim" + - "description_tesim" + predicate: http://purl.org/dc/elements/1.1/description + identifier: + type: string + multiple: true + form: + primary: false + index_keys: + - "identifier_sim" + - "identifier_tesim" + predicate: http://purl.org/dc/terms/identifier + import_url: + type: string + predicate: http://scholarsphere.psu.edu/ns#importUrl + keyword: + type: string + multiple: true + index_keys: + - "keyword_sim" + - "keyword_tesim" + form: + primary: false + predicate: http://schema.org/keywords + publisher: + type: string + multiple: true + form: + primary: false + index_keys: + - "publisher_sim" + - "publisher_tesim" + predicate: http://purl.org/dc/elements/1.1/publisher + label: + type: string + form: + primary: false + index_keys: + - "label_sim" + - "label_tesim" + predicate: info:fedora/fedora-system:def/model#downloadFilename + language: + type: string + multiple: true + form: + primary: false + index_keys: + - "language_sim" + - "language_tesim" + predicate: http://purl.org/dc/elements/1.1/language + license: + type: string + multiple: true + form: + primary: false + index_keys: + - "license_sim" + - "license_tesim" + predicate: http://purl.org/dc/terms/license + relative_path: + type: string + predicate: http://scholarsphere.psu.edu/ns#relativePath + related_url: + type: string + multiple: true + form: + primary: false + index_keys: + - "related_url_sim" + - "related_url_tesim" + predicate: http://www.w3.org/2000/01/rdf-schema#seeAlso + resource_type: + type: string + multiple: true + form: + primary: false + index_keys: + - "resource_type_sim" + - "resource_type_tesim" + predicate: http://purl.org/dc/terms/type + rights_notes: + type: string + multiple: true + form: + primary: false + index_keys: + - "rights_notes_sim" + - "rights_notes_tesim" + predicate: http://purl.org/dc/elements/1.1/rights + rights_statement: + type: string + multiple: true + form: + primary: true + index_keys: + - "rights_statement_sim" + - "rights_statement_tesim" + predicate: http://www.europeana.eu/schemas/edm/rights + source: + type: string + multiple: true + form: + primary: false + index_keys: + - "source_sim" + - "source_tesim" + predicate: http://purl.org/dc/terms/source + subject: + type: string + multiple: true + index_keys: + - "subject_sim" + - "subject_tesim" + form: + primary: false + predicate: http://purl.org/dc/elements/1.1/subject diff --git a/config/metadata/etd_resource.yaml b/config/metadata/etd_resource.yaml new file mode 100644 index 0000000..5e4fddb --- /dev/null +++ b/config/metadata/etd_resource.yaml @@ -0,0 +1,340 @@ +# Simple yaml config-driven schema which is used to define model attributes, +# index key names, and form properties. +# +# Attributes must have a type but all other configuration options are optional. +# Please note: If using Valkyrie's Fedora Metadata Adapter, predicates for attributes +# must be placed here. +# +# attributes: +# attribute_name: +# type: string +# multiple: false +# index_keys: +# - "attribute_name_sim" +# form: +# required: true +# primary: true +# multiple: false +# +# @see config/metadata/basic_metadata.yaml for an example configuration +# +# Generated via +# `rails generate hyrax:work_resource EtdResource` + +attributes: + creator: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "creator_sim" + - "creator_tesim" + predicate: http://purl.org/dc/elements/1.1/creator + keyword: + type: string + multiple: true + index_keys: + - "keyword_sim" + - "keyword_tesim" + form: + primary: true + required: true + predicate: http://schema.org/keywords + rights_statement: + type: string + multiple: true + form: + primary: true + required: true + index_keys: + - "rights_statement_sim" + - "rights_statement_tesim" + predicate: http://www.europeana.eu/schemas/edm/rights + date: + type: string + multiple: true + index_keys: + - "date_tesim" + - "date_sim" + form: + required: true + primary: true + multiple: true + predicate: https://hykucommons.org/terms/date + degree_name: + type: string + multiple: true + index_keys: + - "degree_name_tesim" + form: + required: true + primary: true + multiple: true + predicate: https://hykucommons.org/terms/degree_name + degree_level: + type: string + multiple: true + index_keys: + - "degree_level_tesim" + form: + required: true + primary: true + multiple: true + predicate: https://hykucommons.org/terms/degree_level + degree_discipline: + type: string + multiple: true + index_keys: + - "degree_discipline_tesim" + form: + required: true + primary: true + multiple: true + predicate: https://hykucommons.org/terms/degree_discipline + degree_grantor: + type: string + multiple: true + index_keys: + - "degree_grantor_tesim" + form: + required: true + primary: true + multiple: true + predicate: https://hykucommons.org/terms/degree_grantor + resource_type: + type: string + multiple: true + form: + primary: true + multiple: true + required: true + index_keys: + - "resource_type_sim" + - "resource_type_tesim" + predicate: http://purl.org/dc/terms/type + license: + type: string + multiple: true + form: + primary: false + index_keys: + - "license_sim" + - "license_tesim" + predicate: http://purl.org/dc/terms/license + abstract: + type: string + multiple: true + form: + primary: false + index_keys: + - "abstract_sim" + - "abstract_tesim" + predicate: http://purl.org/dc/terms/abstract + access_right: + type: string + multiple: true + form: + primary: false + index_keys: + - "access_right_sim" + - "access_right_tesim" + predicate: http://purl.org/dc/terms/accessRights + additional_information: + type: string + multiple: true + index_keys: + - "additional_information_tesim" + form: + required: false + primary: false + multiple: true + predicate: http://purl.org/dc/terms/accessRights + admin_note: + type: string + multiple: false + index_keys: + - "admin_note_tesim" + form: + required: false + primary: false + multiple: false + predicate: http://schema.org/positiveNotes + advisor: + type: string + multiple: true + index_keys: + - "advisor_tesim" + form: + required: false + primary: false + multiple: true + predicate: https://hykucommons.org/terms/advisor + alternative_title: + type: string + multiple: true + form: + primary: false + index_keys: + - "alternative_title_sim" + - "alternative_title_tesim" + predicate: http://purl.org/dc/terms/alternative + based_near: + type: string + multiple: true + form: + primary: false + index_keys: + - "based_near_sim" + - "based_near_tesim" + predicate: http://xmlns.com/foaf/0.1/based_near + bibliographic_citation: + type: string + multiple: true + form: + primary: false + index_keys: + - "bibliographic_citation_sim" + - "bibliographic_citation_tesim" + predicate: http://purl.org/dc/terms/bibliographicCitation + committee_member: + type: string + multiple: true + index_keys: + - "committee_member_tesim" + form: + required: false + primary: false + multiple: true + predicate: https://hykucommons.org/terms/committee_member + contributor: + type: string + multiple: true + form: + primary: false + index_keys: + - "contributor_tesim" + - "contributor_sim" + predicate: http://purl.org/dc/elements/1.1/contributor + department: + type: string + multiple: true + index_keys: + - "department_tesim" + form: + required: false + primary: false + multiple: true + predicate: https://hykucommons.org/terms/department + description: + type: string + multiple: true + form: + primary: false + index_keys: + - "description_sim" + - "description_tesim" + predicate: http://purl.org/dc/elements/1.1/description + format: + type: string + multiple: true + index_keys: + - "format_tesim" + form: + required: false + primary: false + multiple: true + predicate: http://purl.org/dc/terms/format + identifier: + type: string + multiple: true + form: + primary: false + index_keys: + - "identifier_sim" + - "identifier_tesim" + predicate: http://purl.org/dc/terms/identifier + language: + type: string + multiple: true + form: + primary: false + index_keys: + - "language_sim" + - "language_tesim" + predicate: http://purl.org/dc/elements/1.1/language + publisher: + type: string + multiple: true + form: + primary: false + index_keys: + - "publisher_sim" + - "publisher_tesim" + predicate: http://purl.org/dc/elements/1.1/publisher + related_url: + type: string + multiple: true + form: + primary: false + index_keys: + - "related_url_sim" + - "related_url_tesim" + predicate: http://www.w3.org/2000/01/rdf-schema#seeAlso + rights_notes: + type: string + multiple: true + form: + primary: false + index_keys: + - "rights_notes_sim" + - "rights_notes_tesim" + predicate: http://purl.org/dc/elements/1.1/rights + source: + type: string + multiple: true + form: + primary: false + index_keys: + - "source_sim" + - "source_tesim" + predicate: http://purl.org/dc/terms/source + subject: + type: string + multiple: true + index_keys: + - "subject_sim" + - "subject_tesim" + form: + primary: false + predicate: http://purl.org/dc/elements/1.1/subject + arkivo_checksum: + type: string + multiple: false + # form: + # primary: false + predicate: http://scholarsphere.psu.edu/ns#arkivoChecksum + date_created: + type: date_time + multiple: true + # form: + # primary: false + index_keys: + - "date_created_sim" + - "date_created_tesim" + predicate: http://purl.org/dc/terms/created + import_url: + type: string + predicate: http://scholarsphere.psu.edu/ns#importUrl + label: + type: string + # form: + # primary: false + index_keys: + - "label_sim" + - "label_tesim" + predicate: info:fedora/fedora-system:def/model#downloadFilename + relative_path: + type: string + predicate: http://scholarsphere.psu.edu/ns#relativePath diff --git a/config/metadata/generic_work_resource.yaml b/config/metadata/generic_work_resource.yaml new file mode 100644 index 0000000..c750ae3 --- /dev/null +++ b/config/metadata/generic_work_resource.yaml @@ -0,0 +1,249 @@ +# Simple yaml config-driven schema which is used to define model attributes, +# index key names, and form properties. +# +# Attributes must have a type but all other configuration options are optional. +# Please note: If using Valkyrie's Fedora Metadata Adapter, predicates for attributes +# must be placed here. +# +# attributes: +# attribute_name: +# type: string +# multiple: false +# index_keys: +# - "attribute_name_sim" +# form: +# required: true +# primary: true +# multiple: false +# +# @see config/metadata/basic_metadata.yaml for an example configuration +# +# Generated via +# `rails generate hyrax:work_resource GenericWorkResource` + +attributes: + creator: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "creator_sim" + - "creator_tesim" + predicate: http://purl.org/dc/elements/1.1/creator + keyword: + type: string + multiple: true + index_keys: + - "keyword_sim" + - "keyword_tesim" + form: + required: true + primary: true + predicate: http://schema.org/keywords + rights_statement: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "rights_statement_sim" + - "rights_statement_tesim" + predicate: http://www.europeana.eu/schemas/edm/rights + resource_type: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "resource_type_sim" + - "resource_type_tesim" + predicate: http://purl.org/dc/terms/type + license: + type: string + multiple: true + form: + primary: false + index_keys: + - "license_sim" + - "license_tesim" + predicate: http://purl.org/dc/terms/license + abstract: + type: string + multiple: true + form: + primary: false + index_keys: + - "abstract_sim" + - "abstract_tesim" + predicate: http://purl.org/dc/terms/abstract + access_right: + type: string + multiple: true + form: + primary: false + index_keys: + - "access_right_sim" + - "access_right_tesim" + predicate: http://purl.org/dc/terms/accessRights + additional_information: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "additional_information_tesim" + predicate: http://purl.org/dc/terms/accessRights + admin_note: + type: string + multiple: false + form: + primary: false + multiple: false + index_keys: + - "admin_note_tesim" + predicate: http://schema.org/positiveNotes + alternative_title: + type: string + multiple: true + form: + primary: false + index_keys: + - "alternative_title_sim" + - "alternative_title_tesim" + predicate: http://purl.org/dc/terms/alternative + based_near: + type: string + multiple: true + form: + primary: false + index_keys: + - "based_near_sim" + - "based_near_tesim" + predicate: http://xmlns.com/foaf/0.1/based_near + bibliographic_citation: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "bibliographic_citation_tesim" + predicate: http://purl.org/dc/terms/bibliographicCitation + contributor: + type: string + multiple: true + form: + primary: false + index_keys: + - "contributor_tesim" + - "contributor_sim" + predicate: http://purl.org/dc/elements/1.1/contributor + date_created: + type: date_time + multiple: true + form: + primary: false + index_keys: + - "date_created_sim" + - "date_created_tesim" + predicate: http://purl.org/dc/terms/created + description: + type: string + multiple: true + form: + primary: false + index_keys: + - "description_sim" + - "description_tesim" + predicate: http://purl.org/dc/elements/1.1/description + identifier: + type: string + multiple: true + form: + primary: false + index_keys: + - "identifier_sim" + - "identifier_tesim" + predicate: http://purl.org/dc/terms/identifier + language: + type: string + multiple: true + form: + primary: false + index_keys: + - "language_sim" + - "language_tesim" + predicate: http://purl.org/dc/elements/1.1/language + publisher: + type: string + multiple: true + form: + primary: false + index_keys: + - "publisher_sim" + - "publisher_tesim" + predicate: http://purl.org/dc/elements/1.1/publisher + related_url: + type: string + multiple: true + form: + primary: false + index_keys: + - "related_url_sim" + - "related_url_tesim" + predicate: http://www.w3.org/2000/01/rdf-schema#seeAlso + rights_notes: + type: string + multiple: true + form: + primary: false + index_keys: + - "rights_notes_sim" + - "rights_notes_tesim" + predicate: http://purl.org/dc/elements/1.1/rights + source: + type: string + multiple: true + form: + primary: false + index_keys: + - "source_sim" + - "source_tesim" + predicate: http://purl.org/dc/terms/source + subject: + type: string + multiple: true + index_keys: + - "subject_sim" + - "subject_tesim" + form: + primary: false + predicate: http://purl.org/dc/elements/1.1/subject + date: + type: string + multiple: false + index_keys: + - "date_tesim" + - "date_sim" + predicate: https://hykucommons.org/terms/date + arkivo_checksum: + type: string + multiple: false + predicate: http://scholarsphere.psu.edu/ns#arkivoChecksum + import_url: + type: string + predicate: http://scholarsphere.psu.edu/ns#importUrl + label: + type: string + index_keys: + - "label_sim" + - "label_tesim" + predicate: info:fedora/fedora-system:def/model#downloadFilename + relative_path: + type: string + predicate: http://scholarsphere.psu.edu/ns#relativePath diff --git a/config/metadata/image_resource.yaml b/config/metadata/image_resource.yaml new file mode 100644 index 0000000..f74b2cd --- /dev/null +++ b/config/metadata/image_resource.yaml @@ -0,0 +1,255 @@ +# Simple yaml config-driven schema which is used to define model attributes, +# index key names, and form properties. +# +# Attributes must have a type but all other configuration options are optional. +# Please note: If using Valkyrie's Fedora Metadata Adapter, predicates for attributes +# must be placed here. +# +# attributes: +# attribute_name: +# type: string +# multiple: false +# index_keys: +# - "attribute_name_sim" +# form: +# required: true +# primary: true +# multiple: false +# +# @see config/metadata/basic_metadata.yaml for an example configuration +# +# Generated via +# `rails generate hyrax:work_resource GenericWorkResource` + +attributes: + creator: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "creator_sim" + - "creator_tesim" + predicate: http://purl.org/dc/elements/1.1/creator + keyword: + type: string + multiple: true + index_keys: + - "keyword_sim" + - "keyword_tesim" + form: + required: true + primary: true + predicate: http://schema.org/keywords + resource_type: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "resource_type_sim" + - "resource_type_tesim" + predicate: http://purl.org/dc/terms/type + rights_statement: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "rights_statement_sim" + - "rights_statement_tesim" + predicate: http://www.europeana.eu/schemas/edm/rights + license: + type: string + multiple: true + form: + primary: false + index_keys: + - "license_sim" + - "license_tesim" + predicate: http://purl.org/dc/terms/license + abstract: + type: string + multiple: true + form: + primary: false + index_keys: + - "abstract_sim" + - "abstract_tesim" + predicate: http://purl.org/dc/terms/abstract + access_right: + type: string + multiple: true + form: + primary: false + index_keys: + - "access_right_sim" + - "access_right_tesim" + predicate: http://purl.org/dc/terms/accessRights + additional_information: + type: string + multiple: true + form: + primary: false + index_keys: + - "additional_information_tesim" + predicate: http://purl.org/dc/terms/accessRights + admin_note: + type: string + multiple: false + form: + primary: false + index_keys: + - "admin_note_tesim" + predicate: http://schema.org/positiveNotes + alternative_title: + type: string + multiple: true + form: + primary: false + index_keys: + - "alternative_title_sim" + - "alternative_title_tesim" + predicate: http://purl.org/dc/terms/alternative + based_near: + type: string + multiple: true + form: + primary: false + index_keys: + - "based_near_sim" + - "based_near_tesim" + predicate: http://xmlns.com/foaf/0.1/based_near + bibliographic_citation: + type: string + multiple: true + form: + primary: false + index_keys: + - "bibliographic_citation_tesim" + predicate: http://purl.org/dc/terms/bibliographicCitation + contributor: + type: string + multiple: true + form: + primary: false + index_keys: + - "contributor_tesim" + - "contributor_sim" + predicate: http://purl.org/dc/elements/1.1/contributor + date_created: + type: date_time + multiple: true + form: + primary: false + index_keys: + - "date_created_sim" + - "date_created_tesim" + predicate: http://purl.org/dc/terms/created + description: + type: string + multiple: true + form: + primary: false + index_keys: + - "description_sim" + - "description_tesim" + predicate: http://purl.org/dc/elements/1.1/description + extent: + type: string + multiple: true + form: + primary: false + index_keys: + - "extent_tesim" + predicate: http://purl.org/dc/terms/extent + identifier: + type: string + multiple: true + form: + primary: false + index_keys: + - "identifier_sim" + - "identifier_tesim" + predicate: http://purl.org/dc/terms/identifier + language: + type: string + multiple: true + form: + primary: false + index_keys: + - "language_sim" + - "language_tesim" + predicate: http://purl.org/dc/elements/1.1/language + publisher: + type: string + multiple: true + form: + primary: false + index_keys: + - "publisher_sim" + - "publisher_tesim" + predicate: http://purl.org/dc/elements/1.1/publisher + related_url: + type: string + multiple: true + form: + primary: false + index_keys: + - "related_url_sim" + - "related_url_tesim" + predicate: http://www.w3.org/2000/01/rdf-schema#seeAlso + rights_notes: + type: string + multiple: true + form: + primary: false + index_keys: + - "rights_notes_sim" + - "rights_notes_tesim" + predicate: http://purl.org/dc/elements/1.1/rights + source: + type: string + multiple: true + form: + primary: false + index_keys: + - "source_sim" + - "source_tesim" + predicate: http://purl.org/dc/terms/source + subject: + type: string + multiple: true + index_keys: + - "subject_sim" + - "subject_tesim" + form: + primary: false + predicate: http://purl.org/dc/elements/1.1/subject + date: + type: string + multiple: false + index_keys: + - "date_tesim" + - "date_sim" + predicate: https://hykucommons.org/terms/date + arkivo_checksum: + type: string + multiple: false + predicate: http://scholarsphere.psu.edu/ns#arkivoChecksum + import_url: + type: string + predicate: http://scholarsphere.psu.edu/ns#importUrl + label: + type: string + index_keys: + - "label_sim" + - "label_tesim" + predicate: info:fedora/fedora-system:def/model#downloadFilename + relative_path: + type: string + predicate: http://scholarsphere.psu.edu/ns#relativePath + diff --git a/config/metadata/oer_resource.yaml b/config/metadata/oer_resource.yaml new file mode 100644 index 0000000..27aeb56 --- /dev/null +++ b/config/metadata/oer_resource.yaml @@ -0,0 +1,380 @@ +# Simple yaml config-driven schema which is used to define model attributes, +# index key names, and form properties. +# +# Attributes must have a type but all other configuration options are optional. +# Please note: If using Valkyrie's Fedora Metadata Adapter, predicates for attributes +# must be placed here. +# +# attributes: +# attribute_name: +# type: string +# multiple: false +# index_keys: +# - "attribute_name_sim" +# form: +# required: true +# primary: true +# multiple: false +# +# @see config/metadata/basic_metadata.yaml for an example configuration +# +# Generated via +# `rails generate hyrax:work_resource OerResource` + +attributes: + creator: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "creator_sim" + - "creator_tesim" + predicate: http://purl.org/dc/elements/1.1/creator + resource_type: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "resource_type_sim" + - "resource_type_tesim" + predicate: http://purl.org/dc/terms/type + date_created: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "date_created_tesim" + predicate: http://purl.org/dc/terms/date + audience: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "audience_tesim" + - "audience_sim" + predicate: http://schema.org/EducationalAudience + education_level: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "education_level_tesim" + - "education_level_sim" + predicate: http://purl.org/dc/terms/educationLevel + learning_resource_type: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "learning_resource_type_tesim" + - "learning_resource_type_sim" + predicate: http://schema.org/learningResourceType + discipline: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "discipline_tesim" + predicate: https://hykucommons.org/terms/degree_discipline + rights_statement: + type: string + multiple: true + form: + required: true + primary: true + index_keys: + - "rights_statement_sim" + - "rights_statement_tesim" + predicate: http://www.europeana.eu/schemas/edm/rights + license: + type: string + multiple: true + form: + primary: false + index_keys: + - "license_sim" + - "license_tesim" + predicate: http://purl.org/dc/terms/license + abstract: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "abstract_sim" + - "abstract_tesim" + predicate: http://purl.org/dc/terms/abstract + accessibility_feature: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "accessibility_feature_tesim" + - "accessibility_feature_sim" + predicate: http://schema.org/accessibilityFeature + accessibility_hazard: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "accessibility_hazard_tesim" + - "accessibility_hazard_sim" + predicate: http://schema.org/accessibilityHazard + accessibility_summary: + type: string + multiple: false + form: + primary: false + multiple: false + index_keys: + - "accessibility_summary_tesim" + - "accessibility_summary_sim" + predicate: http://schema.org/accessibilitySummary + additional_information: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "additional_information_tesim" + predicate: http://purl.org/dc/terms/accessRights + admin_note: + type: string + multiple: false + form: + primary: false + multiple: false + index_keys: + - "admin_note_tesim" + predicate: http://schema.org/positiveNotes + alternative_title: + type: string + multiple: true + form: + primary: false + index_keys: + - "alternative_title_sim" + - "alternative_title_tesim" + predicate: http://purl.org/dc/terms/alternative + bibliographic_citation: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "bibliographic_citation_sim" + - "bibliographic_citation_tesim" + predicate: http://purl.org/dc/terms/bibliographicCitation + contributor: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "contributor_tesim" + - "contributor_sim" + predicate: http://purl.org/dc/elements/1.1/contributor + description: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "description_sim" + - "description_tesim" + predicate: http://purl.org/dc/elements/1.1/description + identifier: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "identifier_sim" + - "identifier_tesim" + predicate: http://purl.org/dc/terms/identifier + keyword: + type: string + multiple: true + index_keys: + - "keyword_sim" + - "keyword_tesim" + form: + primary: false + multiple: true + predicate: http://schema.org/keywords + language: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "language_sim" + - "language_tesim" + predicate: http://purl.org/dc/elements/1.1/language + oer_size: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "oer_size_tesim" + predicate: http://purl.org/dc/terms/extent + publisher: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "publisher_sim" + - "publisher_tesim" + predicate: http://purl.org/dc/elements/1.1/publisher + related_url: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "related_url_sim" + - "related_url_tesim" + predicate: http://www.w3.org/2000/01/rdf-schema#seeAlso + rights_holder: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "rights_holder_tesim" + - "rights_holder_sim" + predicate: http://purl.org/dc/terms/rightsHolder + rights_notes: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "rights_notes_tesim" + predicate: https://hykucommons.org/terms/rights_notes + source: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "source_sim" + - "source_tesim" + predicate: http://purl.org/dc/terms/source + subject: + type: string + multiple: true + index_keys: + - "subject_sim" + - "subject_tesim" + form: + primary: false + multiple: true + predicate: http://purl.org/dc/elements/1.1/subject + table_of_contents: + type: string + multiple: true + form: + primary: false + multiple: true + index_keys: + - "table_of_contents_tesim" + predicate: http://purl.org/dc/terms/tableOfContents + previous_version_id: + type: string + multiple: true + index_keys: + - "previous_version_id_tesim" + - "previous_version_id_sim" + predicate: http://purl.org/dc/terms/replaces + newer_version_id: + type: string + multiple: true + index_keys: + - "newer_version_id_tesim" + - "newer_version_id_sim" + predicate: http://purl.org/dc/terms/isReplacedBy + alternate_version_id: + type: string + multiple: true + index_keys: + - "alternate_version_id_tesim" + - "alternate_version_id_sim" + predicate: http://purl.org/dc/terms/hasVersion + related_item_id: + type: string + multiple: true + index_keys: + - "related_item_id_tesim" + - "related_item_id_sim" + predicate: http://purl.org/dc/terms/relation + date: + type: string + multiple: false + index_keys: + - "date_tesim" + - "date_sim" + predicate: https://hykucommons.org/terms/date + access_right: + type: string + multiple: true + index_keys: + - "access_right_sim" + - "access_right_tesim" + predicate: http://purl.org/dc/terms/accessRights + arkivo_checksum: + type: string + multiple: false + predicate: http://scholarsphere.psu.edu/ns#arkivoChecksum + based_near: + type: string + multiple: true + index_keys: + - "based_near_sim" + - "based_near_tesim" + predicate: http://xmlns.com/foaf/0.1/based_near + import_url: + type: string + predicate: http://scholarsphere.psu.edu/ns#importUrl + label: + type: string + index_keys: + - "label_sim" + - "label_tesim" + predicate: info:fedora/fedora-system:def/model#downloadFilename + relative_path: + type: string + predicate: http://scholarsphere.psu.edu/ns#relativePath diff --git a/hyrax-webapp b/hyrax-webapp index 66c9217..1de2d9c 160000 --- a/hyrax-webapp +++ b/hyrax-webapp @@ -1 +1 @@ -Subproject commit 66c9217a72a9cf39c9fa467920fb701149f599b4 +Subproject commit 1de2d9c31a6d53536c47ebee32061d6f0498ac44 diff --git a/lib/generators/hyku_knapsack/work_resource/work_resource_generator.rb b/lib/generators/hyku_knapsack/work_resource/work_resource_generator.rb index 067f816..1fb9435 100644 --- a/lib/generators/hyku_knapsack/work_resource/work_resource_generator.rb +++ b/lib/generators/hyku_knapsack/work_resource/work_resource_generator.rb @@ -121,13 +121,14 @@ def insert_hyku_works_controller_behavior def insert_hyku_extra_includes_into_model model = File.join('../app/models/', class_path, "#{file_name}.rb") + af_model = "#{class_name}".gsub('Resource', '')&.safe_constantize if class_name.end_with?('Resource') insert_into_file model, before: "end" do <<-RUBY.gsub(/^ {8}/, ' ') include Hyrax::Schema(:with_pdf_viewer) include Hyrax::Schema(:with_video_embed) include Hyrax::ArResource include Hyrax::NestedWorks - + #{ "\n Hyrax::ValkyrieLazyMigration.migrating(self, from: #{af_model})\n" if af_model } include IiifPrint.model_configuration( pdf_split_child_model: GenericWorkResource, pdf_splitter_service: IiifPrint::TenantConfig::PdfSplitter @@ -138,6 +139,14 @@ def insert_hyku_extra_includes_into_model end end + def insert_hyku_extra_includes_into_form + form = File.join('../app/forms/', class_path, "#{file_name}_form.rb") + insert_into_file form, after: "include Hyrax::FormFields(:#{file_name})\n" do + " include Hyrax::FormFields(:with_pdf_viewer)\n" \ + " include Hyrax::FormFields(:with_video_embed)\n" + end + end + private def rspec_installed? diff --git a/lib/hyku_knapsack/engine.rb b/lib/hyku_knapsack/engine.rb index cb94870..1b57df5 100644 --- a/lib/hyku_knapsack/engine.rb +++ b/lib/hyku_knapsack/engine.rb @@ -48,7 +48,7 @@ def self.load_translations! Hyrax::SimpleSchemaLoader.prepend(Hyrax::SimpleSchemaLoaderDecorator) end - config.after_initialize do + config.to_prepare do HykuKnapsack::Engine.root.glob("app/**/*_decorator*.rb").sort.each do |c| Rails.configuration.cache_classes ? require(c) : load(c) end @@ -56,7 +56,9 @@ def self.load_translations! HykuKnapsack::Engine.root.glob("lib/**/*_decorator*.rb").sort.each do |c| Rails.configuration.cache_classes ? require(c) : load(c) end + end + config.after_initialize do Hyrax::DerivativeService.services = [ IiifPrint::PluggableDerivativeService ] diff --git a/spec/indexers/cdl_resource_indexer_spec.rb b/spec/indexers/cdl_resource_indexer_spec.rb new file mode 100644 index 0000000..40aee8c --- /dev/null +++ b/spec/indexers/cdl_resource_indexer_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource CdlResource` +require 'rails_helper' +require 'hyrax/specs/shared_specs/indexers' + +RSpec.describe CdlResourceIndexer do + let(:indexer_class) { described_class } + let(:resource) { CdlResource.new } + + it_behaves_like 'a Hyrax::Resource indexer' +end diff --git a/spec/indexers/etd_resource_indexer_spec.rb b/spec/indexers/etd_resource_indexer_spec.rb new file mode 100644 index 0000000..88dc315 --- /dev/null +++ b/spec/indexers/etd_resource_indexer_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource EtdResource` +require 'rails_helper' +require 'hyrax/specs/shared_specs/indexers' + +RSpec.describe EtdResourceIndexer do + let(:indexer_class) { described_class } + let(:resource) { EtdResource.new } + + it_behaves_like 'a Hyrax::Resource indexer' +end diff --git a/spec/indexers/oer_resource_indexer_spec.rb b/spec/indexers/oer_resource_indexer_spec.rb new file mode 100644 index 0000000..bbb63d9 --- /dev/null +++ b/spec/indexers/oer_resource_indexer_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource OerResource` +require 'rails_helper' +require 'hyrax/specs/shared_specs/indexers' + +RSpec.describe OerResourceIndexer do + let(:indexer_class) { described_class } + let(:resource) { OerResource.new } + + it_behaves_like 'a Hyrax::Resource indexer' +end diff --git a/spec/models/cdl_resource_spec.rb b/spec/models/cdl_resource_spec.rb new file mode 100644 index 0000000..14bbc39 --- /dev/null +++ b/spec/models/cdl_resource_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource CdlResource` +require 'rails_helper' +require 'hyrax/specs/shared_specs/hydra_works' + +RSpec.describe CdlResource do + subject(:work) { described_class.new } + + it_behaves_like 'a Hyrax::Work' +end diff --git a/spec/models/etd_resource_spec.rb b/spec/models/etd_resource_spec.rb new file mode 100644 index 0000000..3629e41 --- /dev/null +++ b/spec/models/etd_resource_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource EtdResource` +require 'rails_helper' +require 'hyrax/specs/shared_specs/hydra_works' + +RSpec.describe EtdResource do + subject(:work) { described_class.new } + + it_behaves_like 'a Hyrax::Work' +end diff --git a/spec/models/oer_resource_spec.rb b/spec/models/oer_resource_spec.rb new file mode 100644 index 0000000..421ea08 --- /dev/null +++ b/spec/models/oer_resource_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource OerResource` +require 'rails_helper' +require 'hyrax/specs/shared_specs/hydra_works' + +RSpec.describe OerResource do + subject(:work) { described_class.new } + + it_behaves_like 'a Hyrax::Work' +end diff --git a/spec/views/cdl_resources/_cdl_resource.html.erb_spec.rb b/spec/views/cdl_resources/_cdl_resource.html.erb_spec.rb new file mode 100644 index 0000000..a3120c4 --- /dev/null +++ b/spec/views/cdl_resources/_cdl_resource.html.erb_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource CdlResource` +RSpec.describe 'cdl_resources/cdl_resource.html.erb', type: :view do # rubocop:disable RSpec/EmptyExampleGroup + # add cdl_resource view specs +end diff --git a/spec/views/etd_resources/_etd_resource.html.erb_spec.rb b/spec/views/etd_resources/_etd_resource.html.erb_spec.rb new file mode 100644 index 0000000..3ade049 --- /dev/null +++ b/spec/views/etd_resources/_etd_resource.html.erb_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource EtdResource` +RSpec.describe 'etd_resources/etd_resource.html.erb', type: :view do # rubocop:disable RSpec/EmptyExampleGroup + # add etd_resource view specs +end diff --git a/spec/views/oer_resources/_oer_resource.html.erb_spec.rb b/spec/views/oer_resources/_oer_resource.html.erb_spec.rb new file mode 100644 index 0000000..cef97a7 --- /dev/null +++ b/spec/views/oer_resources/_oer_resource.html.erb_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# Generated via +# `rails generate hyrax:work_resource OerResource` +RSpec.describe 'oer_resources/oer_resource.html.erb', type: :view do # rubocop:disable RSpec/EmptyExampleGroup + # add oer_resource view specs +end