This repository has been archived by the owner on May 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow ImageWorks to pull metadata from bibdata and display image in U…
…niversal Viewer
- Loading branch information
1 parent
703665a
commit eecdcc1
Showing
24 changed files
with
3,968 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Hyrax::GeoWorksController < ApplicationController | ||
include Hyrax::WorksControllerBehavior | ||
include Hyrax::BreadcrumbsForWorks | ||
include GeoWorks::GeoblacklightControllerBehavior | ||
include Hyrax::GeoMessengerBehavior | ||
|
||
private | ||
|
||
def decorator | ||
CompositeDecorator.new(NullDecorator) | ||
end | ||
|
||
def curation_concern | ||
@decorated_concern ||= | ||
begin | ||
@curation_concern = decorator.new(@curation_concern) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module ApplyRemoteMetadata | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
validate :source_metadata_identifier_or_title | ||
|
||
def apply_remote_metadata | ||
if remote_data.source | ||
self.source_metadata = remote_data.source.dup.try(:force_encoding, 'utf-8') | ||
end | ||
if remote_data.respond_to?(:jsonld) | ||
self.source_jsonld = remote_data.jsonld.dup.try(:force_encoding, 'utf-8') | ||
end | ||
self.attributes = enumerable_to_single_valued_attributes(remote_data.attributes) | ||
CompleteRecord.new(self).complete if workflow_state == 'complete' && identifier.present? | ||
end | ||
|
||
private | ||
|
||
def enumerable_to_single_valued_attributes(attributes) | ||
attributes.merge(attributes) do |key, value| | ||
next unless value | ||
single_valued_attributes.include?(key) ? value.first : value | ||
end | ||
end | ||
|
||
def single_valued_attributes | ||
attributes.map { |key, value| key unless value.is_a? Enumerable }.compact | ||
end | ||
|
||
def remote_data | ||
@remote_data ||= remote_metadata_factory.retrieve(source_metadata_identifier) | ||
end | ||
|
||
def remote_metadata_factory | ||
if RemoteRecord.bibdata?(source_metadata_identifier) == 0 | ||
JSONLDRecord::Factory.new(self.class) | ||
else | ||
RemoteRecord | ||
end | ||
end | ||
|
||
# Validate that either the source_metadata_identifier or the title is set. | ||
def source_metadata_identifier_or_title | ||
return if source_metadata_identifier.present? || title.present? | ||
errors.add(:title, "You must provide a source metadata id or a title") | ||
errors.add(:source_metadata_identifier, "You must provide a source metadata id or a title") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
class ImageWorkShowPresenter < GeoWorks::ImageWorkShowPresenter | ||
include PlumAttributes | ||
delegate :viewing_hint, :viewing_direction, :logical_order, :logical_order_object, :ocr_language, to: :solr_document | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
class VectorWorkShowPresenter < GeoWorks::VectorWorkShowPresenter | ||
include PlumAttributes | ||
|
||
# self.file_format_service = GeoConcerns::VectorFormatService | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<% if collector || editor %> | ||
<div class="form-actions"> | ||
<% if editor %> | ||
<%= link_to "Edit This #{@presenter.human_readable_type}", edit_polymorphic_path([main_app, @presenter]), class: 'btn btn-default' %> | ||
<div class="btn-group"> | ||
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown" href="#"> Attach File <span class="caret"></span></button> | ||
<ul class="dropdown-menu"> | ||
<li> | ||
<%= link_to "Attach Image", main_app.new_hyrax_file_set_path(@presenter, type: 'image-data') %> | ||
</li> | ||
<li> | ||
<%= link_to "Attach Metadata", main_app.new_hyrax_file_set_path(@presenter, type: 'metadata') %> | ||
</li> | ||
</ul> | ||
</div> | ||
<% end %> | ||
<%= link_to "Delete This #{@presenter.human_readable_type}", [main_app, @presenter], class: 'btn btn-danger pull-right', data: { confirm: "Delete this #{@presenter.human_readable_type}?" }, method: :delete %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<% provide :page_title, @presenter.page_title %> | ||
<% provide :page_header do %> | ||
<%= render "hyrax/base/title_header" %> | ||
<% if @parent_presenter %> | ||
<ul class="breadcrumb"> | ||
<li><%= link_to @parent_presenter, polymorphic_path([main_app, @parent_presenter]) %></li> | ||
<li class="active"><%= @presenter.human_readable_type %></li> | ||
</ul> | ||
<% else %> | ||
<span class="human_readable_type">(<%= @presenter.human_readable_type %>)</span> | ||
<% end %> | ||
<% end %> | ||
<% collector = can?(:collect, @presenter.id) %> | ||
<% editor = can?(:edit, @presenter.id) %> | ||
<%= render 'representative_media', presenter: @presenter %> | ||
<%= render 'geo_works/metadata', presenter: @presenter %> | ||
<%= render 'geo_works/relationships', presenter: @presenter %> | ||
<%= render 'geo_works/related/geo_files', presenter: @presenter %> | ||
<%= render 'geo_works/related/external_metadata_files', presenter: @presenter %> | ||
<%= render 'workflow_actions', presenter: @presenter if @presenter.workflow.actions.present? %> | ||
<%= render "show_actions", collector: collector, editor: editor%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.