Skip to content

Commit

Permalink
Copied all pieces of mobius work type so test in staging because for …
Browse files Browse the repository at this point in the history
…some reason not working locally
  • Loading branch information
aprilrieger committed Sep 19, 2024
1 parent 4f8214b commit fa1361a
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/controllers/hyrax/unca_works_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# Generated via
# `rails generate hyrax:work_resource UncaWork`
module Hyrax
# Generated controller for UncaWork
class UncaWorksController < ApplicationController
# Adds Hyrax behaviors to the controller.
include Hyrax::WorksControllerBehavior
include Hyku::WorksControllerBehavior
include Hyrax::BreadcrumbsForWorks
self.curation_concern_type = ::UncaWork

# Use a Valkyrie aware form service to generate Valkyrie::ChangeSet style
# forms.
self.work_form_service = Hyrax::FormFactory.new
end
end
22 changes: 22 additions & 0 deletions app/forms/unca_work_form.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

# Generated via
# `rails generate hyrax:work_resource UncaWork`
#
# @see https://github.com/samvera/hyrax/wiki/Hyrax-Valkyrie-Usage-Guide#forms
# @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking
class UncaWorkForm < Hyrax::Forms::PcdmObjectForm(UncaWork)
include Hyrax::FormFields(:basic_metadata)
include Hyrax::FormFields(:unca_work)
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
19 changes: 19 additions & 0 deletions app/indexers/unca_work_indexer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# Generated via
# `rails generate hyrax:work_resource UncaWork`
class UncaWorkIndexer < Hyrax::Indexers::PcdmObjectIndexer(UncaWork)
include Hyrax::Indexer(:basic_metadata)
include Hyrax::Indexer(:unca_work)
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
14 changes: 14 additions & 0 deletions app/models/unca_work.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

# Generated via
# `rails generate hyrax:work_resource UncaWork`
class UncaWork < Hyrax::Work
include Hyrax::Schema(:basic_metadata)
include Hyrax::Schema(:unca_work)
include Hyrax::Schema(:with_pdf_viewer)
include Hyrax::Schema(:with_video_embed)
include Hyrax::ArResource
include Hyrax::NestedWorks

prepend OrderAlready.for(:creator)
end
2 changes: 2 additions & 0 deletions app/views/hyrax/unca_works/_unca_work.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%# This is a search result view %>
<%= render 'catalog/document', document: unca_work, document_counter: unca_work_counter %>
1 change: 1 addition & 0 deletions config/initializers/hyrax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
Rails.application.config.after_initialize do
Hyrax.config do |config|
config.register_curation_concern :mobius_work
config.register_curation_concern :unca_work
end
end
64 changes: 64 additions & 0 deletions config/metadata/unca_work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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 UncaWork`

attributes:
rights:
type: string
multiple: true
index_keys:
- "rights_tesim"
form:
required: false
primary: false
multiple: true
predicate: http://purl.org/dc/terms/rightsHolder
relation:
type: string
multiple: true
index_keys:
- "relation_tesim"
form:
required: false
primary: false
multiple: true
predicate: http://purl.org/dc/terms/relation
coverage:
type: string
multiple: true
index_keys:
- "coverage_tesim"
form:
required: false
primary: false
multiple: true
predicate: http://purl.org/dc/terms/coverage
file_format:
type: string
multiple: true
index_keys:
- "file_format_tesim"
form:
required: false
primary: false
multiple: true
predicate: http://purl.org/dc/terms/FileFormat

0 comments on commit fa1361a

Please sign in to comment.