-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensures that Ephemera Projects have IIIF Manifests #385
Merged
tpendragon
merged 7 commits into
master
from
issues-364-jrgriffiniii-ephemera-project-manifest
Oct 18, 2017
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c7ae5e2
Resolves #346 by ensuring that Ephemera Projects have IIIF Manifests …
jrgriffiniii 09b3e2c
Ensuring that the "slug" property for EphemeraProjects is required; F…
jrgriffiniii a6fed8f
Removing Slug generation functionality from the EphemeraProjectDecorator
jrgriffiniii 6384f6d
Removing the JavaScript auto-generation for slugs; Ensuring that slug…
jrgriffiniii 5336c5e
Checking for unique slug values within the EphemeraProjectChangeSet u…
jrgriffiniii 418a25d
Extending the EphemeraProjectChangeSet to include validation for slug…
jrgriffiniii db322e9
Upgrading to Ruby release 2.3.4 for the CircleCI build environment
jrgriffiniii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,10 +1,36 @@ | ||
# frozen_string_literal: true | ||
class EphemeraProjectChangeSet < Valkyrie::ChangeSet | ||
validates :title, presence: true | ||
validates :title, :slug, presence: true | ||
property :title, multiple: false | ||
property :member_ids, multiple: true, required: false, type: Types::Strict::Array.member(Valkyrie::Types::ID) | ||
property :slug, multiple: false, required: true | ||
validate :slug_unique? | ||
validate :slug_valid? | ||
|
||
def primary_terms | ||
[:title] | ||
[:title, :slug] | ||
end | ||
|
||
def slug_valid? | ||
return if Slug.new(Array.wrap(slug).first).valid? | ||
errors.add(:slug, 'contains invalid characters, please only use alphanumerics, dashes, and underscores') | ||
end | ||
|
||
def slug_unique? | ||
return unless slug_exists? | ||
errors.add(:slug, 'is already in use by another project') | ||
end | ||
|
||
private | ||
|
||
def metadata_adapter | ||
Valkyrie.config.metadata_adapter | ||
end | ||
delegate :query_service, to: :metadata_adapter | ||
|
||
def slug_exists? | ||
slug_value = Array.wrap(slug).first | ||
results = query_service.custom_queries.find_by_string_property(property: :slug, value: slug_value).to_a | ||
!results.empty? | ||
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
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,6 @@ | ||
# frozen_string_literal: true | ||
class IndexCollectionDecorator < Valkyrie::ResourceDecorator | ||
def iiif_manifest_attributes | ||
[] | ||
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
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,3 +1,13 @@ | ||
# frozen_string_literal: true | ||
# Model for exposing IIIF Manifests for all Collection resources | ||
class IndexCollection | ||
# Decorates the object (as this is not a Valkyrie::Resource) | ||
# @return [IndexCollectionDecorator] an instance of the decorator | ||
def decorate | ||
IndexCollectionDecorator.new(self) | ||
end | ||
|
||
def logical_structure | ||
[] | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want it to be single-value, we should enforce that on the changeset. But I'm not sure we want it to be single-value. I'm concerned we actually need 2 properties, like current_slug and all_slugs, so that the front-end app can continue routing to old / bookmarked urls. I think this may need more discussion / a new issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it already is enforced on the changeset, okay. Well the rest of my concern still stands :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created a new issue for handling changed slugs gracefully — not sure if it's ultimately something that needs to change in DPUL or Figgy, but it's something that should work: #395