Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
Adding logo and license to manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
escowles committed Jul 19, 2017
1 parent 824562f commit d850080
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
Binary file added app/assets/images/pul_logo_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/presenters/plum_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def rights_statement
RightsStatementRenderer.new(solr_document.rights_statement, solr_document.rights_note).render
end

def rights_statement_uri
Array.wrap(solr_document.rights_statement).first
end

def holding_location
HoldingLocationRenderer.new(solr_document.holding_location).render
end
Expand Down
10 changes: 10 additions & 0 deletions app/services/manifest_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def builders
metadata_builder,
thumbnail_builder,
see_also_builder,
logo_builder,
license_builder,
rendering_builder
)
end
Expand Down Expand Up @@ -72,6 +74,14 @@ def see_also_builder
SeeAlsoBuilder.new(record)
end

def logo_builder
LogoBuilder.new(ssl: @ssl)
end

def license_builder
LicenseBuilder.new(record)
end

def rendering_builder
RenderingBuilder.new(record)
end
Expand Down
14 changes: 14 additions & 0 deletions app/services/manifest_builder/license_builder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class ManifestBuilder
class LicenseBuilder
attr_reader :record
def initialize(record)
@record = record
end

def apply(manifest)
return unless record.try(:rights_statement_uri)
manifest.license = record.rights_statement_uri
manifest
end
end
end
20 changes: 20 additions & 0 deletions app/services/manifest_builder/logo_builder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class ManifestBuilder
class LogoBuilder
def initialize(ssl: false)
@ssl = ssl
end

def apply(manifest)
manifest.logo = "#{protocol}://#{host}/assets/pul_logo_icon.png"
manifest
end

def protocol
@ssl ? 'https' : 'http'
end

def host
Plum.default_url_options[:host]
end
end
end
6 changes: 6 additions & 0 deletions spec/services/polymorphic_manifest_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,12 @@ def build_file_set(id, geo_mime_type = nil)
it "has a description" do
expect(result.description).to eq Array(record.description)
end
it "has a license" do
expect(result.license).to eq('http://rightsstatements.org/vocab/NKC/1.0/')
end
it "has a logo" do
expect(result.logo).to eq('http://plum.com/assets/pul_logo_icon.png')
end
context "when it has a bibdata ID" do
it "links to JSON-LD and bibdata" do
expect(json_result["seeAlso"].first["@id"]).to eq "http://plum.com/concern/scanned_resources/1.jsonld"
Expand Down

0 comments on commit d850080

Please sign in to comment.