Add Clover IIIF viewer and install generator (rails g hyrax:iiif_viewer clover)#7400
Add Clover IIIF viewer and install generator (rails g hyrax:iiif_viewer clover)#7400eltiffster merged 9 commits intomainfrom
Conversation
Test Results 17 files ± 0 17 suites ±0 3h 28m 40s ⏱️ + 1m 3s Results for commit 3631843. ± Comparison against base commit aced8ad. This pull request removes 443 and adds 449 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
The explanation here made sense to me: rubocop/ruby-style-guide#809
…yrax into install-iiif-av-viewer
|
Thanks for this! Since this generates files in the codebase, I'm concerned this is setup to run via a rake task calling a |
cjcolvar
left a comment
There was a problem hiding this comment.
I tested this out locally (at least installing) and it worked great!
| iiif_viewer_base_url(:universal_viewer) | ||
| end | ||
|
|
||
| def iiif_viewer_base_url(viewer) |
|
I'm going to try basing my Ramp installer on this branch. |
|
Thanks @dlpierce for the feedback! I think it was just easier for me to wrap my head around it conceptually at first as a service, and also handy for testing. Now that you mention it, I do see that it would make sense as a rails generator. And it would probably make the code cleaner too. It shouldn't be too hard to refactor. |
…ce class) To install Clover: rails generate hyrax:iiif_viewer clover To remove Clover: rails destroy hyrax:iiif_viewer clover
|
@cjcolvar Since converting this to a generator, this would be the new hypothetical file structure for ramp: And the new commands: Hope this helps! |
|
this is super cool! |
This PR addresses this issue on the March 26 Samvera Community Sprint Board. It's primarily motivated by the need to display subtitles or captions in the audio/video player (i.e. IIIF viewer). Universal Viewer does not support subtitles or captions at time of writing.
Summary
Add Clover IIIF Viewer and
rake taskgenerator for installing and configuring Clover as the default audio/video viewer.Guidance for testing, such as acceptance criteria or new user interface behaviors:
rails generate hyrax:iiif_viewer cloverrails hyrax:clover:installrake taskgenerator should copy HTML, CSS, and JS files into your app'spublic/cloverdirectory, and a_clover.html.erbintoapp/views/hyrax/base/iiif_viewersconfig.iiif_av_viewer = :cloverinto your app'sconfig/initializers/hyrax.rbrails destroy hyrax:iiif_viewer clover(and restart).Hyrax::InstallIiifViewerService.remove(:clover)in the rails consoleType of change (for release notes)
notes-minorNew Features that are backward compatibleDetailed Description
Why Use a Flat/Vanilla JavaScript File?
Based on discussions about an install generator for Ramp into Hyrax with @kirkkwang, @Dananji, @cjcolvar, and @nhomenda, I decided to use this "Vanilla JavaScript" example as a model for this implementation for these reasons:
Tradeoffs and Caveats
Since the JS file is minified/pre-bundled, it can be hard to configure/customize Clover without using JS frameworks like Node, React, Next.js, etc. (Minor changes are possible but not easy to read; see comments in
clover.js.)Also, there doesn't seem to be an easy way to turn off the "Download" option in the options menu.
I hope that's not a dealbreaker since default Hyrax treats read/download permissions as equivalent. However, administrators/developers of downstream apps may want to be aware of this. I think Ramp disables that feature by default, so Ramp could be a future alternative for those who need stricter permissions for downloads.
Backwards Compatibility
I see minimal impact on existing applications, but let me know if there's anything I've missed. I modified
app/helpers/hyrax/iiif_helperto use a generalizediiif_viewer_base_urlmethod so it would work with Clover and potentially other IIIF viewers as well. Theuniversal_viewer_base_urlmethod still exists with these changes.Notes on Potential Reuse
You can reuse the install generator for other IIIF viewers. For example, if you have a vanilla JS implementation prepared for Ramp with a file structure like so:
Then run the following on the command line:
When running in a test environment, the
servicegenerator copies files into thetmpdirectory instead to avoid mishaps with your dev environment.@samvera/hyrax-code-reviewers