Skip to content

Commit

Permalink
Merge pull request #271 from scientist-softserv/add-unca-work-type
Browse files Browse the repository at this point in the history
  • Loading branch information
aprilrieger authored Sep 26, 2024
2 parents 4f8214b + a233a1c commit dac476a
Show file tree
Hide file tree
Showing 9 changed files with 422 additions and 1,583 deletions.
1,581 changes: 0 additions & 1,581 deletions Gemfile.lock

This file was deleted.

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
18 changes: 18 additions & 0 deletions app/forms/unca_work_form.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`
#
# @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(:unca_work)
# 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
16 changes: 16 additions & 0 deletions app/indexers/unca_work_indexer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

# Generated via
# `rails generate hyrax:work_resource UncaWork`
class UncaWorkIndexer < Hyrax::Indexers::PcdmObjectIndexer(UncaWork)
include Hyrax::Indexer(:unca_work)

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
7 changes: 7 additions & 0 deletions app/models/unca_work.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

# Generated via
# `rails generate hyrax:work_resource UncaWork`
class UncaWork < Hyrax::Work
include Hyrax::Schema(:unca_work)
end
4 changes: 2 additions & 2 deletions app/presenters/hyku/work_show_presenter_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

# OVERRIDE Hyku to delegate Mobius properties

Hyku::WorkShowPresenter.delegate :rights, :relation, :coverage, :file_format, to: :solr_document
# OVERRIDE Hyku to delegate Unca property :date_published
Hyku::WorkShowPresenter.delegate :rights, :relation, :coverage, :file_format, :date_published, to: :solr_document
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
Loading

0 comments on commit dac476a

Please sign in to comment.