Skip to content

Commit

Permalink
Merge pull request #1821 from sul-dlss/media-viewer-attribution#1797
Browse files Browse the repository at this point in the history
Enhance rights panel in left companion window of media player
  • Loading branch information
jcoyne authored Nov 27, 2023
2 parents 93bda97 + c758463 commit cea3d90
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 4 deletions.
11 changes: 11 additions & 0 deletions app/assets/stylesheets/media.scss
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,18 @@
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
}

.logoContainer {
padding: 1rem;
border-bottom: .5px solid rgba(0, 0, 0, 0.25);
}

.attributionLogo {
max-width: 100%;
}

.metadataList, .rightsList {
border-bottom: .5px solid rgba(0, 0, 0, 0.25);

dt {
font-size: 0.878rem;
font-weight: 500;
Expand Down
11 changes: 8 additions & 3 deletions app/components/rights_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
<% end %>
<% if license.present? %>
<dt>License</dt>
<dd>
<%= license %>
</dd>
<dd><%= license %></dd>
<% end %>
<% if no_rights_information_present? %>
<dt>Attribution</dt>
<dd><%= default_attribution %></dd>
<% end %>
</dl>
<div class="logoContainer">
<%= image_tag stanford_libraries_logo_url, alt: "Stanford Libraries logo", role: "presentation", class: "attributionLogo" %>
</div>
16 changes: 16 additions & 0 deletions app/components/rights_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,20 @@ def initialize(viewer:)

delegate :purl_object, to: :viewer
delegate :use_and_reproduction, :copyright, :license, to: :purl_object

def no_rights_information_present?
use_and_reproduction.blank? &&
copyright.blank? &&
license.blank?
end

def default_attribution
'Provided by the Stanford University Libraries'
end

def stanford_libraries_logo_url
# NOTE: This is the URL Mirador already uses, so this increases parity between the
# image and media viewers even if it may appear brittle
'https://stacks.stanford.edu/image/iiif/wy534zh7137/SULAIR_rosette/full/400,/0/default.jpg'
end
end
17 changes: 16 additions & 1 deletion spec/components/rights_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,24 @@
license: 'cc-0')
end

it 'renders something useful' do
it 'renders the rights information and an attribution logo' do
expect(page).to have_content 'The materials are open for research use'
expect(page).to have_content 'cc-0'
expect(page).to have_content 'The Board of Trustees of the Leland Stanford Junior University'
expect(page).not_to have_content 'Provided by the Stanford University Libraries'
expect(page).to have_css('img.attributionLogo')
end

context 'when object has no rights information' do
let(:purl_object) do
instance_double(Embed::Purl,
use_and_reproduction: nil,
copyright: nil,
license: nil)
end

it 'renders the default attribution information' do
expect(page).to have_content 'Provided by the Stanford University Libraries'
end
end
end

0 comments on commit cea3d90

Please sign in to comment.