Skip to content

Commit

Permalink
Merge pull request #2849 from samvera/2837-add-sidebar-to-management-…
Browse files Browse the repository at this point in the history
…pages

2837 add sidebar to management pages
  • Loading branch information
elrayle authored Mar 29, 2018
2 parents 63f1f29 + f9fcbe5 commit 948b67b
Show file tree
Hide file tree
Showing 16 changed files with 241 additions and 147 deletions.
10 changes: 10 additions & 0 deletions app/controllers/concerns/hyrax/embargoes_controller_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ module EmbargoesControllerBehavior
include Hyrax::Collections::AcceptsBatches

def index
add_breadcrumb t(:'hyrax.controls.home'), root_path
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path
authorize! :index, Hydra::AccessControls::Embargo
end

Expand Down Expand Up @@ -40,5 +43,12 @@ def update
def self.local_prefixes
['hyrax/base']
end

def edit
add_breadcrumb t(:'hyrax.controls.home'), root_path
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path
add_breadcrumb t(:'hyrax.embargoes.edit.embargo_update'), '#'
end
end
end
10 changes: 10 additions & 0 deletions app/controllers/concerns/hyrax/leases_controller_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ module LeasesControllerBehavior
include Hyrax::Collections::AcceptsBatches

def index
add_breadcrumb t(:'hyrax.controls.home'), root_path
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
add_breadcrumb t(:'hyrax.leases.index.manage_leases'), hyrax.leases_path
authorize! :index, Hydra::AccessControls::Lease
end

Expand Down Expand Up @@ -33,5 +36,12 @@ def update
def self.local_prefixes
['hyrax/base']
end

def edit
add_breadcrumb t(:'hyrax.controls.home'), root_path
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
add_breadcrumb t(:'hyrax.leases.index.manage_leases'), hyrax.leases_path
add_breadcrumb t(:'hyrax.leases.edit.lease_update'), '#'
end
end
end
2 changes: 2 additions & 0 deletions app/controllers/hyrax/batch_edits_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class BatchEditsController < ApplicationController
# provides the help_text view method
helper PermissionsHelper

with_themed_layout 'dashboard'

def edit
work = form_class.model_class.new
work.depositor = current_user.user_key
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/hyrax/embargoes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Hyrax
class EmbargoesController < ApplicationController
include Hyrax::EmbargoesControllerBehavior

with_themed_layout 'dashboard'
end
end
12 changes: 12 additions & 0 deletions app/controllers/hyrax/file_sets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class FileSetsController < ApplicationController
private :curation_concern=
helper_method :file_set

layout :decide_layout

# GET /concern/file_sets/:id
def edit
initialize_edit_form
Expand Down Expand Up @@ -168,5 +170,15 @@ def additional_response_formats(_); end
def _prefixes
@_prefixes ||= super + ['hyrax/base']
end

def decide_layout
layout = case action_name
when 'show'
'1_column'
else
'dashboard'
end
File.join(theme, layout)
end
end
end
2 changes: 2 additions & 0 deletions app/controllers/hyrax/leases_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Hyrax
class LeasesController < ApplicationController
include Hyrax::LeasesControllerBehavior

with_themed_layout 'dashboard'
end
end
91 changes: 47 additions & 44 deletions app/views/hyrax/batch_edits/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,32 @@
<%= @form.names.join(", ").html_safe %>
</div> <!-- /original values -->

<div >
<div>
<h3> Descriptions:</h3>

<div class="panel panel-default tabs">
<ul class="nav nav-tabs">
<li id="edit_descriptions_link" class="active"><a href="#descriptions_display" data-toggle="tab"><i class="glyphicon glyphicon-tags"></i> Descriptions</a></li>
<li id="edit_permissions_link"><a href="#permissions_display" data-toggle="tab"><i class="glyphicon glyphicon-lock"></i> Permissions</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="descriptions_display">
<% @form.terms.each do |term| %>
<div class="row">
<%= simple_form_for @form,
url: hyrax.batch_edits_path,
method: :put,
remote: true,
builder: Hyrax::FormBuilder,
html: { id: "form_#{term.to_s}",
class: "ajax-form" },
data: { model: @form.model_name.param_key } do |f| %>
<div class="col-xs-12 col-sm-4">
<a class="accordion-toggle grey glyphicon-chevron-right-helper collapsed" data-toggle="collapse" href="#collapse_<%= term %>" id="expand_link_<%=term.to_s%>">
<%= f.input_label term %> <span class="chevron"></span>
</a>
</div>
<div id="collapse_<%= term %>" class="collapse scrolly col-xs-12 col-sm-7">
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane active" id="descriptions_display">
<% @form.terms.each do |term| %>
<div class="row">
<%= simple_form_for @form,
url: hyrax.batch_edits_path,
method: :put,
remote: true,
builder: Hyrax::FormBuilder,
html: { id: "form_#{term.to_s}",
class: "ajax-form" },
data: { model: @form.model_name.param_key } do |f| %>
<div class="col-xs-12 col-sm-4">
<a class="accordion-toggle grey glyphicon-chevron-right-helper collapsed" data-toggle="collapse" href="#collapse_<%= term %>" id="expand_link_<%=term.to_s%>">
<%= f.input_label term %> <span class="chevron"></span>
</a>
</div>
<div id="collapse_<%= term %>" class="collapse scrolly col-xs-12 col-sm-7">
<%= hidden_field_tag('update_type', 'update') %>
<%= hidden_field_tag('key', term.to_s) %>
<%# TODO we don't need to show required %>
Expand All @@ -42,34 +43,36 @@
<a class="btn btn-default" data-toggle="collapse" data-parent="#row_<%= term.to_s %>" href="#collapse_<%= term.to_s %>">Cancel </a>
<div class="status fleft"></div>
</div>
</div>
<% end %>
</div>
<% end %>
</div><!-- #descriptions_display -->
</div>
<% end %>
</div>
<% end %>
</div><!-- #descriptions_display -->

<div id="permissions_display" class="tab-pane">
<%= simple_form_for @form.model,
url: hyrax.batch_edits_path,
method: :put,
remote: true,
html: { id: "form_permissions", class: "ajax-form"},
data: { 'param-key' => @form.model_name.param_key } do |f| %>
<%= hidden_field_tag('update_type', 'update') %>
<%= hidden_field_tag('key', 'permissions') %>
<%= render "hyrax/base/form_permission", f: f %>
<%= render "hyrax/base/form_share", f: f %>
<div id="permissions_display" class="tab-pane">
<%= simple_form_for @form.model,
url: hyrax.batch_edits_path,
method: :put,
remote: true,
html: { id: "form_permissions", class: "ajax-form"},
data: { 'param-key' => @form.model_name.param_key } do |f| %>
<%= hidden_field_tag('update_type', 'update') %>
<%= hidden_field_tag('key', 'permissions') %>
<%= render "hyrax/base/form_permission", f: f %>
<%= render "hyrax/base/form_share", f: f %>

<% @form.batch_document_ids.each do |batch_id| %>
<%= hidden_field_tag "batch_document_ids[]", batch_id %>
<% end %>
<div class="row">
<%= f.submit "Save changes", class: 'btn btn-primary', id: 'permissions_save' %>
<div id="status_permissions" class="status fleft"></div>
<% @form.batch_document_ids.each do |batch_id| %>
<%= hidden_field_tag "batch_document_ids[]", batch_id %>
<% end %>
<div class="row">
<%= f.submit "Save changes", class: 'btn btn-primary', id: 'permissions_save' %>
<div id="status_permissions" class="status fleft"></div>
</div>
<% end %>
</div>
<% end %>
</div> <!-- .tab-content -->
</div>
</div> <!-- .tab-content -->
</div>

<!-- Ajax call to clear the batch before page uload. -->
<%= button_to "Clear Batch", hyrax.clear_batch_edits_path, form_class: 'hidden', remote: true, id: 'clear_batch' %>
Expand Down
82 changes: 47 additions & 35 deletions app/views/hyrax/embargoes/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,54 @@
<h1><%= t('.manage_embargoes_html', cc: curation_concern, cc_type: cc_type) %></h1>
<% end %>

<h2><%= t('.header.current') %></h2>
<%= simple_form_for [main_app, curation_concern] do |f| %>
<fieldset class="set-access-controls">
<section class="help-block">
<p>
<% if curation_concern.embargo_release_date %>
<%= t('.embargo_true_html', cc: cc_type) %>
<% else %>
<%= t('.embargo_false_html', cc: cc_type) %>
<% end %>
</p>
</section>
<div class="panel panel-default tabs">
<div class="panel-heading">
<h2 class="panel-title"><%= t('.header.current') %></h2>
</div>
<div class="panel-body">
<%= simple_form_for [main_app, curation_concern] do |f| %>
<fieldset class="set-access-controls">
<section class="help-block">
<p>
<% if curation_concern.embargo_release_date %>
<%= t('.embargo_true_html', cc: cc_type) %>
<% else %>
<%= t('.embargo_false_html', cc: cc_type) %>
<% end %>
</p>
</section>

<div class="form-group">
<input type="hidden" name="<%= f.object_name %>[visibility]" value="<%= Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO %>" />
<%= render 'hyrax/base/form_permission_embargo', curation_concern: curation_concern, f: f %>
</div>
</fieldset>
<div class="form-group">
<input type="hidden" name="<%= f.object_name %>[visibility]" value="<%= Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO %>" />
<%= render 'hyrax/base/form_permission_embargo', curation_concern: curation_concern, f: f %>
</div>
</fieldset>

<div class="row">
<div class="col-md-12 form-actions">
<% if curation_concern.embargo_release_date %>
<%= f.submit t('.embargo_update'), class: 'btn btn-primary' %>
<%= link_to t('.embargo_deactivate'), embargo_path(curation_concern), method: :delete, class: 'btn btn-danger' %>
<% else %>
<%= f.submit t('.embargo_apply'), class: 'btn btn-primary' %>
<% end %>
<%= link_to t('.embargo_cancel'), embargoes_path, class: 'btn btn-default' %>
<%= link_to t('.embargo_return', cc: cc_type), edit_polymorphic_path([main_app, curation_concern]), class: 'btn btn-default' %>
</div>
<div class="row">
<div class="col-md-12 form-actions">
<% if curation_concern.embargo_release_date %>
<%= f.submit t('.embargo_update'), class: 'btn btn-primary' %>
<%= link_to t('.embargo_deactivate'), embargo_path(curation_concern), method: :delete, class: 'btn btn-danger' %>
<% else %>
<%= f.submit t('.embargo_apply'), class: 'btn btn-primary' %>
<% end %>
<%= link_to t('.embargo_cancel'), embargoes_path, class: 'btn btn-default' %>
<%= link_to t('.embargo_return', cc: cc_type), edit_polymorphic_path([main_app, curation_concern]), class: 'btn btn-default' %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>

<h2><%= t('.header.past') %></h2>
<% if curation_concern.embargo_history.empty? %>
<%= t('.history_empty', cc: cc_type) %>
<% else %>
<%= render partial: "embargo_history", object: curation_concern.embargo_history %>
<% end %>
<div class="panel panel-default tabs">
<div class="panel-heading">
<h2 class="panel-title"><%= t('.header.past') %></h2>
</div>
<div class="panel-body">
<% if curation_concern.embargo_history.empty? %>
<%= t('.history_empty', cc: cc_type) %>
<% else %>
<%= render partial: "embargo_history", object: curation_concern.embargo_history %>
<% end %>
</div>
</div>
13 changes: 6 additions & 7 deletions app/views/hyrax/embargoes/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<h1><span class="fa fa-sitemap"></span><%= t('.manage_embargoes') %></h1>
<% end %>

<div class="panel panel-default">
<div class="panel panel-default tabs">
<ul class="nav nav-tabs">
<li class="active"><a href="#active" data-toggle="tab"><%= t('.active') %></a></li>
<li><a href="#expired" data-toggle="tab"><%= t('.expired') %></a></li>
<li><a href="#deactivated" data-toggle="tab"><%= t('.deactivated') %></a></li>
</ul>
<div class="panel-body">
<ul class="nav nav-tabs">
<li class="active"><a href="#active" data-toggle="tab"><%= t('.active') %></a></li>
<li><a href="#expired" data-toggle="tab"><%= t('.expired') %></a></li>
<li><a href="#deactivated" data-toggle="tab"><%= t('.deactivated') %></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="active">
<%= render "list_active_embargoes" %>
Expand All @@ -22,4 +22,3 @@
</div>
</div>
</div>

44 changes: 24 additions & 20 deletions app/views/hyrax/file_sets/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@
<%= media_display curation_concern.to_presenter %>
</div>
<div class="col-xs-12 col-sm-8">
<ul class="nav nav-tabs" role="tablist">
<li id="edit_descriptions_link" class="active">
<a href="#descriptions_display" data-toggle="tab"><i class="fa fa-tags"></i> Descriptions</a>
</li>
<li id="edit_versioning_link">
<a href="#versioning_display" data-toggle="tab"><i class="fa fa-sitemap"></i> Versions</a>
</li>
<li id="edit_permissions_link">
<a href="#permissions_display" data-toggle="tab"><i class="fa fa-key"></i> Permissions</a>
</li>
</ul>
<div class="tab-content">
<div id="descriptions_display" class="tab-pane active">
<h2>Descriptions </h2>
<%= render "form" %>
<div class="panel panel-default tabs">
<ul class="nav nav-tabs" role="tablist">
<li id="edit_descriptions_link" class="active">
<a href="#descriptions_display" data-toggle="tab"><i class="fa fa-tags"></i> Descriptions</a>
</li>
<li id="edit_versioning_link">
<a href="#versioning_display" data-toggle="tab"><i class="fa fa-sitemap"></i> Versions</a>
</li>
<li id="edit_permissions_link">
<a href="#permissions_display" data-toggle="tab"><i class="fa fa-key"></i> Permissions</a>
</li>
</ul>
<div class="panel-body">
<div class="tab-content">
<div id="descriptions_display" class="tab-pane active">
<h2>Descriptions </h2>
<%= render "form" %>
</div>
<%= render "permission", file_set: curation_concern %>
<%= render "versioning", file_set: curation_concern %>
</div>
</div>
<%= render "permission", file_set: curation_concern %>
<%= render "versioning", file_set: curation_concern %>
</div>
</div><!-- /.col-sm-8 -->
</div><!-- /.row -->
</div><!-- /.col-sm-8 -->
</div><!-- /.row -->
</div>
Loading

0 comments on commit 948b67b

Please sign in to comment.