-
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
Ensures that Ephemera Projects have IIIF Manifests #385
Conversation
9f5ca17
to
73b67a3
Compare
@@ -3,7 +3,7 @@ class EphemeraProjectChangeSet < Valkyrie::ChangeSet | |||
validates :title, 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: false | |||
property :slug, multiple: false, required: true |
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.
This makes it required in the form, but there should be a validation too.
9e08a41
to
4b9ab1c
Compare
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.
There are a lot of nice improvements to readability and idiomatic code in this PR.
I'm a bit confused about the slug. Why does it require a 4-digit suffix? How does the generated UUID relate to the object ID? Shouldn't there be a routing piece? What happens if a slug changes? Is there some 'preferred' or 'primary' slug, but routing will resolve any, i.e. they're all saved in the db and cannot be deleted? If these can simply be answered, perhaps do so in documentation on the model property.
|
||
// UUID Generation without Bower, AMD's, or the NPM | ||
function uuidv4() { | ||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { |
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.
does this become the ID of project, somehow?
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.
Thank you for the review, documentation should indeed be added in order to clarify this feature.
Shouldn't there be a routing piece? What happens if a slug changes? Is there some 'preferred' or 'primary' slug [...]
This does not become the ID of the EphemeraProject. As the slug is entered by the user prior to ingestion (when the ID is assigned), this is simply a UUID-based alternative for generating unique slugs for EphemeraProject Objects.
A unique slug is required for the purposes of publishing messages via the RabbitMQ, but I don't believe that users ever actually reference or otherwise use this slug (from what I've gathered this is used for synchronization with other services such as https://github.com/pulibrary/lae-blacklight). Hence, I don't believe that routing or redirection should be offered. Please correct me if I am wrong @tpendragon or @escowles.
Unless there is a preference for users to generate the slug using their own scheme (i. e. if they happened to track these slugs for purposes of which I'm unaware), then I would think that the automatic generation using JavaScript is entirely unwarranted.
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.
The slug is the user-readable shortname for the project/collection — e.g., for use in DPUL, where the collection URL is dpul.princeton.edu/[slug]. So it should be entered by the user, and shouldn't be auto-generated or have any suffixes, etc. to make sure it's unique. If there is another collection or ephemera project with the slug, an we should just display an error message to the user.
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.
Ah, okay, my understanding was that this would be the basis of a distributable URL to aid in replacing standalone sites like the one for lae with easy-to-access collection pages within figgy/plum. Was I mistaken here? @escowles? Totally possible, considering I didn't know about the messaging use case.
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.
@HackMasterA I think that's right, except the collection pages are in DPUL, not figgy/plum. The point of the slug property is for plum/figgy to tell DPUL what it should use for the collection shortname for building its URLs.
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.
Okay, but we don't need routing because it's not really for use in figgy / plum -- it's just for use in DPUL.
This has been updated and is prepared for another review. |
end | ||
|
||
def validate(resource_params = nil) |
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 don't think we should override validate
. Can you just add a custom method validation instead via something like validate :slug_is_unique
?
While you're adding a validation for uniqueness I would also like to see a validation for suitability in a url. like |
@@ -25,4 +29,20 @@ def manageable_structure? | |||
def title | |||
super.first | |||
end | |||
|
|||
def slug | |||
Array.wrap(super).first |
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
c5af25b
to
fbb8bc6
Compare
fbb8bc6
to
fa28089
Compare
Slug validation has been improved upon as requested and this is prepared for another review. |
Looks good to me! |
…exposing Boxes as Manifests; Ensures that Ephemera Projects have slugs generated for them; Ensures that these slugs are published using RabbitMQ when EphemeraBoxes and EphemeraFolders are updated
…or cases where the slug is generated, use the "title" property in order to generate the slug prefix Ensuring that the "slug" property for the EphemeraProjectChangeSet is present; Adding a JavaScript snippet for populating the "Slug" field within the EphemeraProject form
…s are unique before they are persisted
…sing a custom validation method rather than simply overridding #validate
fa28089
to
418a25d
Compare
Resolves #364 by: