Skip to content
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
merged 7 commits into from
Oct 18, 2017

Conversation

jrgriffiniii
Copy link
Contributor

@jrgriffiniii jrgriffiniii commented Oct 16, 2017

Resolves #364 by:

  • Ensuring that Ephemera Projects have IIIF Manifests (exposing Boxes)
  • Ensures that Ephemera Projects have slugs generated for them
  • Ensures that these slugs are published using RabbitMQ when EphemeraBoxes and EphemeraFolders are updated

@jrgriffiniii jrgriffiniii force-pushed the issues-364-jrgriffiniii-ephemera-project-manifest branch from 9f5ca17 to 73b67a3 Compare October 16, 2017 19:05
@@ -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
Copy link
Contributor

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.

@jrgriffiniii jrgriffiniii force-pushed the issues-364-jrgriffiniii-ephemera-project-manifest branch 3 times, most recently from 9e08a41 to 4b9ab1c Compare October 17, 2017 14:29
Copy link
Member

@hackartisan hackartisan left a 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) {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

@jrgriffiniii jrgriffiniii changed the title Ensures that Ephemera Projects have IIIF Manifests [WIP] Ensures that Ephemera Projects have IIIF Manifests Oct 17, 2017
@jrgriffiniii jrgriffiniii changed the title [WIP] Ensures that Ephemera Projects have IIIF Manifests Ensures that Ephemera Projects have IIIF Manifests Oct 17, 2017
@jrgriffiniii
Copy link
Contributor Author

This has been updated and is prepared for another review.

end

def validate(resource_params = nil)
Copy link
Contributor

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?

@hackartisan
Copy link
Member

While you're adding a validation for uniqueness I would also like to see a validation for suitability in a url. like validate :slug_characters or something that ensures it's only lowercase alphanumeric plus dashes.

@@ -25,4 +29,20 @@ def manageable_structure?
def title
super.first
end

def slug
Array.wrap(super).first
Copy link
Member

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.

Copy link
Member

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 :)

Copy link
Member

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

@jrgriffiniii jrgriffiniii force-pushed the issues-364-jrgriffiniii-ephemera-project-manifest branch from c5af25b to fbb8bc6 Compare October 17, 2017 19:31
@jrgriffiniii jrgriffiniii changed the title Ensures that Ephemera Projects have IIIF Manifests [WIP] Ensures that Ephemera Projects have IIIF Manifests Oct 17, 2017
@jrgriffiniii jrgriffiniii force-pushed the issues-364-jrgriffiniii-ephemera-project-manifest branch from fbb8bc6 to fa28089 Compare October 17, 2017 20:39
@jrgriffiniii jrgriffiniii changed the title [WIP] Ensures that Ephemera Projects have IIIF Manifests Ensures that Ephemera Projects have IIIF Manifests Oct 17, 2017
@jrgriffiniii
Copy link
Contributor Author

Slug validation has been improved upon as requested and this is prepared for another review.

@hackartisan
Copy link
Member

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
…sing a custom validation method rather than simply overridding #validate
@jrgriffiniii jrgriffiniii force-pushed the issues-364-jrgriffiniii-ephemera-project-manifest branch from fa28089 to 418a25d Compare October 18, 2017 13:55
@tpendragon tpendragon merged commit 4eeb873 into master Oct 18, 2017
@tpendragon tpendragon removed the Review label Oct 18, 2017
@tpendragon tpendragon deleted the issues-364-jrgriffiniii-ephemera-project-manifest branch October 18, 2017 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants