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

Replace pul_uv_rails #3696

Merged
merged 2 commits into from
Apr 17, 2019
Merged

Replace pul_uv_rails #3696

merged 2 commits into from
Apr 17, 2019

Conversation

ghost
Copy link

@ghost ghost commented Mar 21, 2019

See #3232

Approach

  • expect universalviewer at {app}/uv/universalviewer (public/uv/universalviewer); install there for CI with yarn package
  • use iframe in view
  • supply default uv.html and uv_config.json
  • add documentation for how to install /configure / override

By using an <iframe>, the universalviewer javascript is self-contained, and need not impact on the main application, allowing for the use of different versions, for example of jquery. It is also easier to swap out, for example, if you have a universal viewer server, you can skip installing universalviewer and customize the uv.html to direct to the new universal viewer location. Examples provided by universalviewer use this <iframe> approach.

Suggested documentation:

Universal Viewer

In order to display the Universal Viewer, Hyrax requires the Unviersal Viewer javascript library. Hyrax expects to find the library at {application_url}/uv/universalviewer (customarily in public/uv/universalviewer).

Installing with YARN

The package.json file located in the application root directory is configured to install universalviewer version 3 into public/uv/universalviewer. The following command will install universalviewer:

yarn run install-uv

Using a different Universal Viewer location

Hyrax uses an <iframe> to display Universal Viewer. The frame displays the default html page located at public/uv.html.

There are two ways to use a different location for Universal Viewer:

  1. Change the specified paths in public/uv.html file.
  2. Override the #universal_viewer_url_base method in app/helpers/hyrax/iiif_helper.rb to point to a different viewer html location

Universal Viewer Config

It is easy to configure Universal Viewer, for example to default the table of contents to be closed or to remove the download options. Hyrax provides a default (empty) configuration file at public\uv_config.json. Customise this file to change the Universal Viewer behavior.

To use a different file altogether, override the #universal_viewer_config_url method in app/helpers/hyrax/iiif_helper.rb.

app/assets/stylesheets/hyrax/_viewer.scss Outdated Show resolved Hide resolved
app/assets/stylesheets/hyrax/_viewer.scss Show resolved Hide resolved
app/assets/stylesheets/hyrax/_viewer.scss Show resolved Hide resolved
app/assets/stylesheets/hyrax/_viewer.scss Outdated Show resolved Hide resolved
@ghost ghost changed the title WIP replace pul_uv_rails **DO NOT MERGE** [WIP] replace pul_uv_rails Apr 5, 2019
app/assets/stylesheets/hyrax/_viewer.scss Show resolved Hide resolved
app/assets/stylesheets/hyrax/_viewer.scss Outdated Show resolved Hide resolved
app/assets/stylesheets/hyrax/_viewer.scss Show resolved Hide resolved
app/assets/stylesheets/hyrax/_viewer.scss Outdated Show resolved Hide resolved
@ghost ghost changed the title [WIP] replace pul_uv_rails Replace pul_uv_rails Apr 8, 2019
@ghost ghost force-pushed the universalviewer branch 2 times, most recently from 4d83de0 to dc92d9d Compare April 8, 2019 08:06
@ghost
Copy link
Author

ghost commented Apr 8, 2019

@no-reply failing with .internal_test_app: No such file or directory ... is there some circeci magic I need to do?

@cjcolvar
Copy link
Member

cjcolvar commented Apr 8, 2019

@geekscruff If you rebase from master you should get an updated circleci config which might work better.

@ghost ghost force-pushed the universalviewer branch 2 times, most recently from a49ad6c to cd73f28 Compare April 8, 2019 21:33
@jrochkind
Copy link
Contributor

For the historical record, what made the iframe necessary, rather than an ordinary div on page as before?

@ghost
Copy link
Author

ghost commented Apr 17, 2019

@jrochkind I'm following what seems to be a common pattern for UV these days, used by Princeton and in examples provided by UV themselves, and (as @jcoyne mentioned) it self-contains the javascript code to avoid version clashes.

I'm very much open constructive feedback on the approach.

Co-Authored-By: geekscruff <julie.allinson@london.ac.uk>
@dlpierce dlpierce merged commit de959fa into master Apr 17, 2019
@ghost ghost removed the in progress label Jul 9, 2019
@jeremyf jeremyf deleted the universalviewer branch January 22, 2020 21:10
jeremyf pushed a commit that referenced this pull request Dec 14, 2022
* Replace pul_uv_rails with a direct install of universal viewer. pul_uv_rail is no longer maintained.

Co-Authored-By: geekscruff <julie.allinson@london.ac.uk>
jeremyf pushed a commit that referenced this pull request Dec 14, 2022
* Replace pul_uv_rails with a direct install of universal viewer. pul_uv_rail is no longer maintained.

Co-Authored-By: geekscruff <julie.allinson@london.ac.uk>

This commit was produced by running the following:

```shell
git cherry-pick de959fa
```

As of this PR, the following tags contain the above commit:

```shell
$ git tag --contains de959fa
v2.5.2
v3.0.0
v3.0.0-rc1
v3.0.0-rc2
v3.0.0.pre.beta3
v3.0.0.pre.rc1
v3.0.0.pre.rc2
v3.0.0.pre.rc3
v3.0.0.pre.rc4
v3.0.1
v3.0.2
v3.1.0
v3.2.0
v3.3.0
v3.4.0
v3.4.1
v3.4.2
v4.0.0.beta1
```

Of note is that this has been back-ported to =v2.5.2=.  With this
change, a proposal is to mint v2.10.0 of Hyrax.
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.

5 participants