Skip to content

Upgrading Universal Viewer

Tiffany Chan edited this page May 13, 2020 · 11 revisions

As of April 2020, we are using Hyrax version 2.3.3, which uses the PulUvRails gem by Princeton University Libraries. The latter is deprecated and has been removed from Hyrax 3. We want to upgrade our Universal Viewer to be like the one in Hyrax 3. For some reason, rake hyrax:universal_viewer:install didn't work for us.)

The following steps to finish the upgrade are based on this issue and this rake task:

  1. Clone this minimal UV example

    git clone https://github.com/UniversalViewer/uv-hello-world.git

  2. Install and copy it to Hyku app.

    cd uv-hello-world
    npm i
    cp uv-hello-world/uv [path to hyku or hyrax]/node_modules/universalviewer/ -r
    cd [path to hyku or hyrax]
    yarn install
    

    Or, you can install the node modules elsewhere (e.g. in /usr/local) and then move the installed module into the public folder.

    cd /usr/local
    git clone https://github.com/UniversalViewer/uv-hello-world.git
    cd uv-hello-world
    npm i
    cp uv.zip [path to hyku or hyrax]/public # or mv uv.zip [path to hyku or hyrax]/public
    cd [path to hyku or hyrax]/public
    unzip uv.zip
  3. Hyrax still needs a few extra files or else you will get an error message.

    • /helpers/hyrax/iiif_helper.rb - see here
    • /services/hyrax/child_types.rb - see here
    • /public/uv/uv-config.json - see here
  4. We need to create/modify some files in order to swap out the old viewer for the new one.

    • /public/uv/uv.html - see here
    • /views/hyrax/base/iiif_viewers/_universal_viewer.html.erb - see here
    • /views/hyrax/base/_representative_media.html.erb - see here
  5. Your UV iframe will draw on the following URL (replace stuff in square brackets to fit your install):

    [tenant base url]/uv/uv.html#?[manifest link]&config=[tenant base url]/uv/uv-config.json

    • tenant base url is the domain name for your tenant (e.g. test.library.uvic.ca)
    • manifest link is the link to the work id + manifest.json (/concerns/generic_works/[work id goes here]/manifest.json)