-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begins to integrate the form functionality for the EphemeraBox and Ep…
…hemeraFolder resources within EphemeraProjects Adding routing and minimal support for EphemeraFolders Implementing a first attempt at supporting EphemeraBox membership and improving the routes for EphemeraBoxes and EphemeraFolders Ensuring that Resources can have IIIF Manifests exposed using the class method "can_have_manifests?"; Ensuring that EphemeraProjects and EphemeraBoxes are linked using the ContextualPath Implementing the attributes for the EphemeraFolders; Resolving issues for ScannedResources Integrating support for membership within EphemeraFolders Tracking files being merge after the latest rebase Adding the Factories and test suites for the Ephemera Decorators Extending the test coverage for the Ephemera* Controllers and Decorators Don't create a real property for append_id Append_id is a virtual property in Valkyrie that exists on ChangeSets. It's not something we want to persist - it's something we act on in a ChangeSetPersister. Extending the coverage for the Ephemera Decorators; Adding test coverage for the EphemeraBox and Folder ChangeSets Increasing the test coverage for EphemeraFolders and the ephemera editor role Clean up box show view. Ensures that IIIF Manifests are properly structured for EphemeraFolders Add Ephemera Folder Workflow Also DRYs this up a bit to make it easier to add another workflow later. Implementing the EphemeraVocabulary Class; Customizing and extending the View templates for EphemeraFields and EphemeraVocabulary objects Increasing the test coverage for Ephemera Vocabularies Extending the coverage for the EphemeraController Resolving a typo. error in the parent breadcrumbs partial Linking EphemeraFolders to vocabulary terms for EphemeraFields Ensures that errors encountered in EphemeraFields are handled properly Extending the coverage for Ephemera* Controllers and access permissions
- Loading branch information
1 parent
00a2e31
commit 4e5592c
Showing
58 changed files
with
1,324 additions
and
26 deletions.
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
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
# frozen_string_literal: true | ||
class EphemeraFieldChangeSet < Valkyrie::ChangeSet | ||
validates :name, presence: true | ||
property :name, multiple: false | ||
validates :field_name, :member_of_vocabulary_id, presence: true | ||
property :field_name, multiple: false, required: true | ||
property :member_of_vocabulary_id, multiple: false, required: true, type: Valkyrie::Types::ID | ||
|
||
def primary_terms | ||
[:name] | ||
[:field_name, :member_of_vocabulary_id, :append_id] | ||
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,21 @@ | ||
# frozen_string_literal: true | ||
class EphemeraTermChangeSet < Valkyrie::ChangeSet | ||
validates :label, :member_of_vocabulary_id, presence: true | ||
property :label, multiple: false, required: true | ||
property :uri, multiple: false, required: false | ||
property :code, multiple: false, required: false | ||
property :tgm_label, multiple: false, required: false | ||
property :lcsh_label, multiple: false, required: false | ||
property :member_of_vocabulary_id, multiple: false, required: true, type: Valkyrie::Types::ID | ||
|
||
def primary_terms | ||
[ | ||
:label, | ||
:uri, | ||
:code, | ||
:tgm_label, | ||
:lcsh_label, | ||
:member_of_vocabulary_id | ||
] | ||
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,12 @@ | ||
# frozen_string_literal: true | ||
class EphemeraVocabularyChangeSet < Valkyrie::ChangeSet | ||
validates :label, :value, presence: true | ||
property :label, multiple: false, required: true | ||
property :value, multiple: false, required: true | ||
property :definition, multiple: false, required: false | ||
property :member_of_vocabulary_id, multiple: false, required: false, type: Valkyrie::Types::ID | ||
|
||
def primary_terms | ||
[:label, :value, :definition, :member_of_vocabulary_id] | ||
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
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
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,25 @@ | ||
# frozen_string_literal: true | ||
class EphemeraTermsController < ApplicationController | ||
include Valhalla::ResourceController | ||
include TokenAuth | ||
self.change_set_class = DynamicChangeSet | ||
self.resource_class = EphemeraTerm | ||
self.change_set_persister = ::PlumChangeSetPersister.new( | ||
metadata_adapter: Valkyrie::MetadataAdapter.find(:indexing_persister), | ||
storage_adapter: Valkyrie.config.storage_adapter | ||
) | ||
before_action :load_vocabularies, only: [:new, :edit] | ||
before_action :load_terms, only: [:index] | ||
|
||
def index | ||
render 'index' | ||
end | ||
|
||
def load_vocabularies | ||
@vocabularies = query_service.find_all_of_model(model: EphemeraVocabulary).map(&:decorate) | ||
end | ||
|
||
def load_terms | ||
@terms = query_service.find_all_of_model(model: EphemeraTerm).map(&:decorate) | ||
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 | ||
class EphemeraVocabulariesController < ApplicationController | ||
include Valhalla::ResourceController | ||
include TokenAuth | ||
self.change_set_class = DynamicChangeSet | ||
self.resource_class = EphemeraVocabulary | ||
self.change_set_persister = ::PlumChangeSetPersister.new( | ||
metadata_adapter: Valkyrie::MetadataAdapter.find(:indexing_persister), | ||
storage_adapter: Valkyrie.config.storage_adapter | ||
) | ||
before_action :load_vocabularies, only: [:index, :new, :edit] | ||
|
||
def index | ||
render 'index' | ||
end | ||
|
||
def load_vocabularies | ||
@vocabularies = query_service.find_all_of_model(model: EphemeraVocabulary).map(&:decorate) | ||
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
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,31 @@ | ||
# frozen_string_literal: true | ||
class EphemeraTermDecorator < Valkyrie::ResourceDecorator | ||
self.display_attributes = [:label, :uri, :code, :tgm_label, :lcsh_label, :vocabulary] | ||
delegate :query_service, to: :metadata_adapter | ||
|
||
def title | ||
label | ||
end | ||
|
||
def metadata_adapter | ||
Valkyrie.config.metadata_adapter | ||
end | ||
|
||
def manageable_files? | ||
false | ||
end | ||
|
||
def manageable_structure? | ||
false | ||
end | ||
|
||
def vocabulary | ||
@vocabulary ||= | ||
begin | ||
query_service.find_references_by(resource: model, property: :member_of_vocabulary_id) | ||
.select { |r| r.is_a?(EphemeraVocabulary) } | ||
.map(&:decorate) | ||
.to_a.first | ||
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,61 @@ | ||
# frozen_string_literal: true | ||
class EphemeraVocabularyDecorator < Valkyrie::ResourceDecorator | ||
self.display_attributes = [:label, :value, :definition, :categories, :terms] | ||
delegate :query_service, to: :metadata_adapter | ||
|
||
def to_s | ||
label | ||
end | ||
|
||
def title | ||
to_s | ||
end | ||
|
||
def metadata_adapter | ||
Valkyrie.config.metadata_adapter | ||
end | ||
|
||
def vocabulary | ||
@vocabulary ||= | ||
begin | ||
query_service.find_references_by(resource: model, property: :member_of_vocabulary_id) | ||
.select { |r| r.is_a?(EphemeraVocabulary) } | ||
.map(&:decorate) | ||
.to_a.first | ||
end | ||
end | ||
|
||
def vocabulary_label | ||
vocabulary.blank? ? 'Unnassigned' : vocabulary.label | ||
end | ||
|
||
def find_references | ||
@referenced_by ||= | ||
begin | ||
query_service.find_inverse_references_by(resource: model, property: :member_of_vocabulary_id) | ||
|
||
end | ||
end | ||
|
||
def categories | ||
@categories ||= | ||
find_references.select { |r| r.is_a?(EphemeraVocabulary) } | ||
.map(&:decorate) | ||
.to_a | ||
end | ||
|
||
def terms | ||
@terms ||= | ||
find_references.select { |r| r.is_a?(EphemeraTerm) } | ||
.map(&:decorate) | ||
.to_a | ||
end | ||
|
||
def manageable_files? | ||
false | ||
end | ||
|
||
def manageable_structure? | ||
false | ||
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
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,11 @@ | ||
# frozen_string_literal: true | ||
class EphemeraTerm < Valhalla::Resource | ||
include Valkyrie::Resource::AccessControls | ||
attribute :id, Valkyrie::Types::ID.optional | ||
attribute :label, Valkyrie::Types::String | ||
attribute :uri, Valkyrie::Types::Any | ||
attribute :code, Valkyrie::Types::Any | ||
attribute :tgm_label, Valkyrie::Types::Any | ||
attribute :lcsh_label, Valkyrie::Types::Any | ||
attribute :member_of_vocabulary_id | ||
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,9 @@ | ||
# frozen_string_literal: true | ||
class EphemeraVocabulary < Valhalla::Resource | ||
include Valkyrie::Resource::AccessControls | ||
attribute :id, Valkyrie::Types::ID.optional | ||
attribute :label, Valkyrie::Types::String | ||
attribute :value, Valkyrie::Types::Any | ||
attribute :definition, Valkyrie::Types::String | ||
attribute :member_of_vocabulary_id | ||
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
Oops, something went wrong.