-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds route, controller action, presenter, and view for inspect_work
- Loading branch information
1 parent
81cb7b9
commit 258f58e
Showing
9 changed files
with
115 additions
and
1 deletion.
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
52 changes: 52 additions & 0 deletions
52
app/presenters/curation_concerns/inspect_work_presenter.rb
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,52 @@ | ||
module CurationConcerns | ||
class InspectWorkPresenter | ||
def initialize(solr_document, current_ability) | ||
@solr_document = solr_document | ||
@current_ability = current_ability | ||
end | ||
attr_reader :solr_document, :current_ability | ||
|
||
def workflow | ||
if sipity_entity | ||
{ | ||
entity_id: sipity_entity.id, | ||
proxy_for: sipity_entity.proxy_for_global_id, | ||
workflow_id: sipity_entity.workflow_id, | ||
workflow_name: sipity_entity.workflow_name, | ||
state_id: sipity_entity.workflow_state_id, | ||
state_name: sipity_entity.workflow_state_name, | ||
roles: sipity_role # TO-DO How to get related roles and actors for the sipity_entity | ||
} | ||
end | ||
end | ||
|
||
def solr | ||
work.to_solr if work | ||
end | ||
|
||
def storage | ||
work.inspect if work | ||
end | ||
|
||
private | ||
|
||
def sipity_entity | ||
@sipity_entity ||= PowerConverter.convert(solr_document, to: :sipity_entity) | ||
rescue PowerConverter::ConversionError | ||
nil | ||
end | ||
|
||
def sipity_role | ||
# TO-DO How to use PowerConverter to get info on roles for a sipity_entity | ||
'Not impmlemented' | ||
end | ||
|
||
def sipity_actor | ||
# TO-DO How to use PowerConverter to get info on actors for a sipity_role | ||
end | ||
|
||
def work | ||
@work ||= sipity_entity.proxy_for if sipity_entity | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<h1><%= t("inspect_work.link_text") %></h1> | ||
<ul class="breadcrumb"> | ||
<li> | ||
Back to <%= link_to @presenter.to_s, [main_app, @presenter] %> | ||
</li> | ||
</ul> | ||
|
||
<h3>Workflow</h3> | ||
<dl> | ||
<% workflow = @presenter.inspect_work.workflow %> | ||
<dt>Object Name</dt> | ||
<dd><%= @presenter.to_s %></dd> | ||
<dt>Processing Entity ID</dt> | ||
<dd><%= workflow[:entity_id] %> (Proxy for <%= workflow[:proxy_for] %>)</dd> | ||
<dt>Workflow Name</dt> | ||
<dd><%= workflow[:workflow_name] %> (ID=<%= workflow[:workflow_id] %>)</dd> | ||
<dt>Workflow State</dt> | ||
<dd><%= workflow[:state_name] %> (ID=<%= workflow[:state_id] %>)</dd> | ||
<dt>Roles</dt> | ||
<dd><%= workflow[:roles] %></dd> | ||
|
||
<h3>Storage</h3> | ||
<dl> | ||
<dt>Work persistence</dt> | ||
<dd><%= @presenter.inspect_work.storage %></dd> | ||
|
||
<dt>Result of to_solr</dt> | ||
<dd><%= @presenter.inspect_work.solr %></dd> | ||
</dl> |
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