-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎁 Generate GenericWorkResource and ImageResource
This commit runs the following commands: ```sh bundle exec rails g hyrax:work_resource GenericWorkResource bundle exec rails g hyrax:work_resource ImageResource ``` Also we update IIIF Print to allow it to boot. See: - scientist-softserv/iiif_print@cc105d0 Ref: - scientist-softserv/hykuup_knapsack#80
- Loading branch information
Showing
20 changed files
with
243 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/controllers/hyrax/generic_work_resources_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource GenericWorkResource` | ||
module Hyrax | ||
# Generated controller for GenericWorkResource | ||
class GenericWorkResourcesController < ApplicationController | ||
# Adds Hyrax behaviors to the controller. | ||
include Hyrax::WorksControllerBehavior | ||
include Hyrax::BreadcrumbsForWorks | ||
self.curation_concern_type = ::GenericWorkResource | ||
|
||
# Use a Valkyrie aware form service to generate Valkyrie::ChangeSet style | ||
# forms. | ||
self.work_form_service = Hyrax::FormFactory.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource ImageResource` | ||
module Hyrax | ||
# Generated controller for ImageResource | ||
class ImageResourcesController < ApplicationController | ||
# Adds Hyrax behaviors to the controller. | ||
include Hyrax::WorksControllerBehavior | ||
include Hyrax::BreadcrumbsForWorks | ||
self.curation_concern_type = ::ImageResource | ||
|
||
# Use a Valkyrie aware form service to generate Valkyrie::ChangeSet style | ||
# forms. | ||
self.work_form_service = Hyrax::FormFactory.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource GenericWorkResource` | ||
# | ||
# @see https://github.com/samvera/hyrax/wiki/Hyrax-Valkyrie-Usage-Guide#forms | ||
# @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking | ||
class GenericWorkResourceForm < Hyrax::Forms::PcdmObjectForm(GenericWorkResource) | ||
include Hyrax::FormFields(:basic_metadata) | ||
include Hyrax::FormFields(:generic_work_resource) | ||
|
||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource ImageResource` | ||
# | ||
# @see https://github.com/samvera/hyrax/wiki/Hyrax-Valkyrie-Usage-Guide#forms | ||
# @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking | ||
class ImageResourceForm < Hyrax::Forms::PcdmObjectForm(ImageResource) | ||
include Hyrax::FormFields(:basic_metadata) | ||
include Hyrax::FormFields(:image_resource) | ||
|
||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GenericWorkResource` | ||
class GenericWorkResourceIndexer < Hyrax::ValkyrieWorkIndexer | ||
include Hyrax::Indexer(:basic_metadata) | ||
include Hyrax::Indexer(:generic_work_resource) | ||
|
||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ImageResource` | ||
class ImageResourceIndexer < Hyrax::ValkyrieWorkIndexer | ||
include Hyrax::Indexer(:basic_metadata) | ||
include Hyrax::Indexer(:image_resource) | ||
|
||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource GenericWorkResource` | ||
class GenericWorkResource < Hyrax::Work | ||
include Hyrax::Schema(:basic_metadata) | ||
include Hyrax::Schema(:generic_work_resource) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource ImageResource` | ||
class ImageResource < Hyrax::Work | ||
include Hyrax::Schema(:basic_metadata) | ||
include Hyrax::Schema(:image_resource) | ||
end |
2 changes: 2 additions & 0 deletions
2
app/views/hyrax/generic_work_resources/_generic_work_resource.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<%# This is a search result view %> | ||
<%= render 'catalog/document', document: generic_work_resource, document_counter: generic_work_resource_counter %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<%# This is a search result view %> | ||
<%= render 'catalog/document', document: image_resource, document_counter: image_resource_counter %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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 ImageResource` | ||
|
||
attributes: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource GenericWorkResource` | ||
require 'rails_helper' | ||
require 'hyrax/specs/shared_specs/indexers' | ||
|
||
RSpec.describe GenericWorkResourceIndexer do | ||
let(:indexer_class) { described_class } | ||
let(:resource) { GenericWorkResource.new } | ||
|
||
it_behaves_like 'a Hyrax::Resource indexer' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource ImageResource` | ||
require 'rails_helper' | ||
require 'hyrax/specs/shared_specs/indexers' | ||
|
||
RSpec.describe ImageResourceIndexer do | ||
let(:indexer_class) { described_class } | ||
let(:resource) { ImageResource.new } | ||
|
||
it_behaves_like 'a Hyrax::Resource indexer' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource GenericWorkResource` | ||
require 'rails_helper' | ||
require 'hyrax/specs/shared_specs/hydra_works' | ||
|
||
RSpec.describe GenericWorkResource do | ||
subject(:work) { described_class.new } | ||
|
||
it_behaves_like 'a Hyrax::Work' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
# Generated via | ||
# `rails generate hyrax:work_resource ImageResource` | ||
require 'rails_helper' | ||
require 'hyrax/specs/shared_specs/hydra_works' | ||
|
||
RSpec.describe ImageResource do | ||
subject(:work) { described_class.new } | ||
|
||
it_behaves_like 'a Hyrax::Work' | ||
end |
7 changes: 7 additions & 0 deletions
7
spec/views/generic_work_resources/_generic_work_resource.html.erb_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GenericWorkResource` | ||
RSpec.describe 'generic_work_resources/generic_work_resource.html.erb', type: :view do # rubocop:disable RSpec/EmptyExampleGroup | ||
# add generic_work_resource view specs | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ImageResource` | ||
RSpec.describe 'image_resources/image_resource.html.erb', type: :view do # rubocop:disable RSpec/EmptyExampleGroup | ||
# add image_resource view specs | ||
end |