Skip to content
Snippets Groups Projects
Commit 1746759f authored by Gyan Gupta's avatar Gyan Gupta Committed by Anusha Ranganathan
Browse files

Added tabs for Archive and Tombstoned

parent ae2e670f
Branches
Tags
1 merge request!270Added tabs for Archive and Tombstoned
# frozen_string_literal: true
module Hyrax
# Presents a list of works in workflow
class Admin::WorkflowsController < ApplicationController
before_action :ensure_authorized!
with_themed_layout 'dashboard'
class_attribute :deposited_workflow_state_name, :archived_workflow_state_name
# Works that are in this workflow state (see workflow json template) are excluded from the
# status list and display in the "Published" tab
self.deposited_workflow_state_name = 'published'
def index
add_breadcrumb t(:'hyrax.controls.home'), root_path
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
add_breadcrumb t(:'hyrax.admin.sidebar.tasks'), '#'
add_breadcrumb t(:'hyrax.admin.sidebar.workflow_review'), request.path
@status_list = actionable_objects.reject(&:published?).select{|object| under_review?(object.workflow_state) }
@published_list = ActiveFedora::Base.where(workflow_state_name_ssim: 'published')
@archived_list = ActiveFedora::Base.where(workflow_state_name_ssim: 'archived')
@tombstoned_list = ActiveFedora::Base.where(is_tombstoned_ssim: 'true')
end
private
def ensure_authorized!
authorize! :review, :submissions
end
def actionable_objects
@actionable_objects ||=
Hyrax::Workflow::ActionableObjects.new(user: current_user)
end
def under_review?(workflow_state)
["pending_review_from_publication_manager","changes_required_from_publication_manager","pending_review_from_crc_manager","changes_required_from_crc_manager","pending_review_from_group_manager","changes_required_from_group_manager"].include?(workflow_state)
end
end
end
\ No newline at end of file
<% provide :page_header do %>
<h1><span class="glyphicon glyphicon-ok-circle"></span> <%= t('.header') %></h1>
<% end %>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default tabs">
<ul class="nav nav-tabs" role="tablist">
<li class="active">
<a href="#under-review" role="tab" data-toggle="tab"><%= t('.tabs.under_review') %></a>
</li>
<li>
<a href="#published" role="tab" data-toggle="tab"><%= t('.tabs.published') %></a>
</li>
<li>
<a href="#archived" role="tab" data-toggle="tab"><%= t('.tabs.archived') %></a>
</li>
<li>
<a href="#tombstoned" role="tab" data-toggle="tab"><%= t('.tabs.tombstoned') %></a>
</li>
</ul>
<div class="tab-content">
<div id="under-review" class="tab-pane active">
<div class="panel panel-default labels">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-condensed table-striped datatable">
<thead>
<tr>
<th width="40%">Work</th>
<th width="20%">Depositor</th>
<th width="20%">Submission Date</th>
<th width="20%">Status</th>
</tr>
</thead>
<tbody>
<% @status_list.each do |document| %>
<tr>
<td>
<%= link_to document, [main_app, document] %>
</td>
<td>
<%= safe_join(document.creator, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending"><%= document.workflow_state %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="published" class="tab-pane">
<div class="panel panel-default labels">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-condensed table-striped datatable">
<thead>
<tr>
<th width="40%">Work</th>
<th width="20%">Depositor</th>
<th width="20%">Submission Date</th>
<th width="20%">Status</th>
</tr>
</thead>
<tbody>
<% @published_list.each do |document| %>
<tr>
<td>
<%= link_to document, [main_app, document] %>
</td>
<td>
<%= safe_join(document.creator.to_a, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending">Published</span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="archived" class="tab-pane">
<div class="panel panel-default labels">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-condensed table-striped datatable">
<thead>
<tr>
<th width="40%">Work</th>
<th width="20%">Depositor</th>
<th width="20%">Submission Date</th>
<th width="20%">Status</th>
</tr>
</thead>
<tbody>
<% @archived_list.each do |document| %>
<tr>
<td>
<%= link_to document.title[0], main_app.polymorphic_path(document) %>
</td>
<td>
<%= safe_join(document.creator.to_a, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending">Archived</span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="tombstoned" class="tab-pane">
<div class="panel panel-default labels">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-condensed table-striped datatable">
<thead>
<tr>
<th width="40%">Work</th>
<th width="20%">Depositor</th>
<th width="20%">Submission Date</th>
<th width="20%">Status</th>
</tr>
</thead>
<tbody>
<% @tombstoned_list.each do |document| %>
<tr>
<td>
<%= link_to document.title[0], main_app.polymorphic_path(document) %>
</td>
<td>
<%= safe_join(document.creator.to_a, tag(:br)) %>
</td>
<td>
<%= document.date_modified %>
</td>
<td>
<span class="state state-pending">Tombstoned</span>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment