Skip to content

Commit

Permalink
CAL-894 Switch to separate static UV (Universal Viewer) (#858)
Browse files Browse the repository at this point in the history
* CAL-984: Seperate UV from Californica.

* CAL-984: Check for RAILS_ENV.

* CAL-984: Sub https for http in iiif_manifest url.

* CAL-984: Add presenter to iiif url.

* CAL-984: Add presenter to iiif url.

* CAL-984

* CAL-984

* CAL-984

* CAL-984

* CAL-984: Update formating for rubocop errors.

* CAL-984: Update formating for rubocop errors.

* CAL-984: Fix test errors.

* CAL-984: Add uv css.

* CAL-984: Update universal viewer css structure to match ursus.

* CAL-984: Add uv css.

* CAL-984: Revert gemfile.

* CAL-984: Fix rubocop error.
  • Loading branch information
aprigge authored Dec 4, 2020
1 parent 007d758 commit 42e4b0b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -937,4 +937,4 @@ RUBY VERSION
ruby 2.5.7p206

BUNDLED WITH
1.17.3
1.17.3
1 change: 1 addition & 0 deletions app/assets/stylesheets/californica.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import 'californica/file_upload';
@import 'californica/main_content';
@import 'californica/wells';
@import 'californica/uv';
10 changes: 10 additions & 0 deletions app/assets/stylesheets/californica/_uv.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.media-viewer-container {
margin: 0 auto;
margin-bottom: 3rem;
width: 100%;
}

.media-viewer-iframe {
width: 100%;
}

21 changes: 21 additions & 0 deletions app/services/californica/iiif_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

module Californica
class IiifService
def http_sub(iiif_manifest_url)
iiif_manifest_url.sub('http:', 'https:')
end

def src(iiif_manifest_url)
if ENV['RAILS_HOST'] == 'localhost' || ENV['RAILS_HOST'] == 'californica-test.library.ucla.edu'
"https://t-w-dl-viewer01.library.ucla.edu/uv.html#?manifest=#{CGI.escape(http_sub(iiif_manifest_url))}"
elsif ENV['RAILS_HOST'] == 'californica-dev.library.ucla.edu'
"https://d-w-dl-viewer01.library.ucla.edu/uv.html#?manifest=#{CGI.escape(http_sub(iiif_manifest_url))}"
elsif ENV['RAILS_HOST'] == 'californica-stage.library.ucla.edu'
"https://s-w-dl-viewer01.library.ucla.edu/uv.html#?manifest=#{CGI.escape(http_sub(iiif_manifest_url))}"
elsif ENV['RAILS_HOST'] == 'californica.library.ucla.edu'
"https://p-w-dl-viewer01.library.ucla.edu/uv.html#?manifest=#{CGI.escape(http_sub(iiif_manifest_url))}"
end
end
end
end
14 changes: 11 additions & 3 deletions app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<%= PulUvRails::UniversalViewer.script_tag %>
<div class="viewer-wrapper">
<div class="uv viewer" data-uri="<%= presenter.iiif_manifest_url %>"></div>
<div class='media-viewer-container'>
<% iiif_service = Californica::IiifService.new() %>
<iframe
class='media-viewer-iframe'
src= "<%= iiif_service.src(presenter.iiif_manifest_url) %>"
width='924px'
height='668px'
id='media-viewer-iframe'
allowfullscreen
frameborder='0'>
</iframe>
</div>

0 comments on commit 42e4b0b

Please sign in to comment.