From a351efce0023eb4dccee9feefaa63cb1f0b239bb Mon Sep 17 00:00:00 2001 From: Jennifer Smith Date: Mon, 26 Mar 2018 15:00:11 -0400 Subject: [PATCH 1/5] Add sidebar to embargo and lease management pages --- .../hyrax/embargoes_controller_behavior.rb | 3 + .../hyrax/leases_controller_behavior.rb | 3 + .../concerns/hyrax/manages_embargoes.rb | 5 +- app/controllers/hyrax/embargoes_controller.rb | 2 + app/controllers/hyrax/leases_controller.rb | 2 + app/views/hyrax/embargoes/edit.html.erb | 82 +++++++++++-------- app/views/hyrax/embargoes/index.html.erb | 13 ++- app/views/hyrax/leases/edit.html.erb | 82 +++++++++++-------- app/views/hyrax/leases/index.html.erb | 12 +-- 9 files changed, 120 insertions(+), 84 deletions(-) diff --git a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb index f8d2cb16ac..ed0a6211cd 100644 --- a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +++ b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb @@ -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 diff --git a/app/controllers/concerns/hyrax/leases_controller_behavior.rb b/app/controllers/concerns/hyrax/leases_controller_behavior.rb index 85b3f7135c..c316cc9642 100644 --- a/app/controllers/concerns/hyrax/leases_controller_behavior.rb +++ b/app/controllers/concerns/hyrax/leases_controller_behavior.rb @@ -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 diff --git a/app/controllers/concerns/hyrax/manages_embargoes.rb b/app/controllers/concerns/hyrax/manages_embargoes.rb index c471d8f81c..805c2aeb8b 100644 --- a/app/controllers/concerns/hyrax/manages_embargoes.rb +++ b/app/controllers/concerns/hyrax/manages_embargoes.rb @@ -13,6 +13,9 @@ def deny_access(exception) redirect_to root_path, alert: exception.message end - def edit; end + def edit + add_breadcrumb t(:'hyrax.controls.home'), root_path + add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path + end end end diff --git a/app/controllers/hyrax/embargoes_controller.rb b/app/controllers/hyrax/embargoes_controller.rb index ce8399059c..bbbb3c5229 100644 --- a/app/controllers/hyrax/embargoes_controller.rb +++ b/app/controllers/hyrax/embargoes_controller.rb @@ -1,5 +1,7 @@ module Hyrax class EmbargoesController < ApplicationController include Hyrax::EmbargoesControllerBehavior + + with_themed_layout 'dashboard' end end diff --git a/app/controllers/hyrax/leases_controller.rb b/app/controllers/hyrax/leases_controller.rb index a9101b447a..96fbeaf048 100644 --- a/app/controllers/hyrax/leases_controller.rb +++ b/app/controllers/hyrax/leases_controller.rb @@ -1,5 +1,7 @@ module Hyrax class LeasesController < ApplicationController include Hyrax::LeasesControllerBehavior + + with_themed_layout 'dashboard' end end diff --git a/app/views/hyrax/embargoes/edit.html.erb b/app/views/hyrax/embargoes/edit.html.erb index b809d12335..376d3f9a40 100644 --- a/app/views/hyrax/embargoes/edit.html.erb +++ b/app/views/hyrax/embargoes/edit.html.erb @@ -4,42 +4,54 @@

<%= t('.manage_embargoes_html', cc: curation_concern, cc_type: cc_type) %>

<% end %> -

<%= t('.header.current') %>

-<%= simple_form_for [main_app, curation_concern] do |f| %> -
-
-

- <% if curation_concern.embargo_release_date %> - <%= t('.embargo_true_html', cc: cc_type) %> - <% else %> - <%= t('.embargo_false_html', cc: cc_type) %> - <% end %> -

-
+
+
+

<%= t('.header.current') %>

+
+
+ <%= simple_form_for [main_app, curation_concern] do |f| %> +
+
+

+ <% if curation_concern.embargo_release_date %> + <%= t('.embargo_true_html', cc: cc_type) %> + <% else %> + <%= t('.embargo_false_html', cc: cc_type) %> + <% end %> +

+
-
- - <%= render 'hyrax/base/form_permission_embargo', curation_concern: curation_concern, f: f %> -
-
+
+ + <%= render 'hyrax/base/form_permission_embargo', curation_concern: curation_concern, f: f %> +
+
-
-
- <% 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' %> -
+
+
+ <% 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' %> +
+
+ <% end %>
-<% end %> + -

<%= t('.header.past') %>

-<% if curation_concern.embargo_history.empty? %> - <%= t('.history_empty', cc: cc_type) %> -<% else %> - <%= render partial: "embargo_history", object: curation_concern.embargo_history %> -<% end %> +
+
+

<%= t('.header.past') %>

+
+
+ <% if curation_concern.embargo_history.empty? %> + <%= t('.history_empty', cc: cc_type) %> + <% else %> + <%= render partial: "embargo_history", object: curation_concern.embargo_history %> + <% end %> +
+
diff --git a/app/views/hyrax/embargoes/index.html.erb b/app/views/hyrax/embargoes/index.html.erb index a8b34a4879..dd861764f2 100644 --- a/app/views/hyrax/embargoes/index.html.erb +++ b/app/views/hyrax/embargoes/index.html.erb @@ -2,13 +2,13 @@

<%= t('.manage_embargoes') %>

<% end %> -
+
+
-
<%= render "list_active_embargoes" %> @@ -22,4 +22,3 @@
- diff --git a/app/views/hyrax/leases/edit.html.erb b/app/views/hyrax/leases/edit.html.erb index f2262a56cb..44a87a9ce0 100644 --- a/app/views/hyrax/leases/edit.html.erb +++ b/app/views/hyrax/leases/edit.html.erb @@ -4,42 +4,54 @@

<%= t('.manage_leases_html', cc: curation_concern, cc_type: cc_type) %>

<% end %> -

<%= t('.header.current') %>

-<%= simple_form_for [main_app, curation_concern] do |f| %> -
-
-

- <% if curation_concern.lease_expiration_date %> - <%= t('.lease_true_html', cc: cc_type) %> - <% else %> - <%= t('.lease_false_html', cc: cc_type) %> - <% end %> -

-
+
+
+

<%= t('.header.current') %>

+
+
+ <%= simple_form_for [main_app, curation_concern] do |f| %> +
+
+

+ <% if curation_concern.lease_expiration_date %> + <%= t('.lease_true_html', cc: cc_type) %> + <% else %> + <%= t('.lease_false_html', cc: cc_type) %> + <% end %> +

+
-
- - <%= render 'hyrax/base/form_permission_lease', curation_concern: curation_concern, f: f %> -
-
+
+ + <%= render 'hyrax/base/form_permission_lease', curation_concern: curation_concern, f: f %> +
+
-
-
- <% if curation_concern.lease_expiration_date %> - <%= f.submit t('.lease_update'), class: 'btn btn-primary' %> - <%= link_to t('.lease_deactivate'), lease_path(curation_concern), method: :delete, class: 'btn btn-danger' %> - <% else %> - <%= f.submit t('.lease_apply'), class: 'btn btn-primary' %> - <% end %> - <%= link_to t('.lease_cancel'), leases_path, class: 'btn btn-default' %> - <%= link_to t('.lease_return', cc: cc_type), edit_polymorphic_path([main_app, curation_concern]), class: 'btn btn-default' %> -
+
+
+ <% if curation_concern.lease_expiration_date %> + <%= f.submit t('.lease_update'), class: 'btn btn-primary' %> + <%= link_to t('.lease_deactivate'), lease_path(curation_concern), method: :delete, class: 'btn btn-danger' %> + <% else %> + <%= f.submit t('.lease_apply'), class: 'btn btn-primary' %> + <% end %> + <%= link_to t('.lease_cancel'), leases_path, class: 'btn btn-default' %> + <%= link_to t('.lease_return', cc: cc_type), edit_polymorphic_path([main_app, curation_concern]), class: 'btn btn-default' %> +
+
+ <% end %>
-<% end %> +
-

<%= t('.header.past') %>

-<% if curation_concern.lease_history.empty? %> - <%= t('.history_empty', cc: cc_type) %> -<% else %> - <%= render partial: 'lease_history', object: curation_concern.lease_history %> -<% end %> +
+
+

<%= t('.header.past') %>

+
+
+ <% if curation_concern.lease_history.empty? %> + <%= t('.history_empty', cc: cc_type) %> + <% else %> + <%= render partial: 'lease_history', object: curation_concern.lease_history %> + <% end %> +
+
diff --git a/app/views/hyrax/leases/index.html.erb b/app/views/hyrax/leases/index.html.erb index dea7347585..8f049bb63e 100644 --- a/app/views/hyrax/leases/index.html.erb +++ b/app/views/hyrax/leases/index.html.erb @@ -2,13 +2,13 @@

<%= t('.manage_leases') %>

<% end %> -
+
+
-
<%= render "list_active_leases" %> From 59044b570b1fcdf2fbcdb038f0c64bd66965b121 Mon Sep 17 00:00:00 2001 From: Jennifer Smith Date: Mon, 26 Mar 2018 16:14:10 -0400 Subject: [PATCH 2/5] Add tests for rendering dashboard partial --- spec/controllers/hyrax/embargoes_controller_spec.rb | 2 ++ spec/controllers/hyrax/leases_controller_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spec/controllers/hyrax/embargoes_controller_spec.rb b/spec/controllers/hyrax/embargoes_controller_spec.rb index 381cca0b89..79dbfb12d9 100644 --- a/spec/controllers/hyrax/embargoes_controller_spec.rb +++ b/spec/controllers/hyrax/embargoes_controller_spec.rb @@ -17,6 +17,7 @@ it 'shows me the page' do get :index expect(response).to be_success + expect(response).to render_template('dashboard') end end end @@ -33,6 +34,7 @@ it 'shows me the page' do get :edit, params: { id: a_work } expect(response).to be_success + expect(response).to render_template('dashboard') end end end diff --git a/spec/controllers/hyrax/leases_controller_spec.rb b/spec/controllers/hyrax/leases_controller_spec.rb index 8e6dedb283..bffd9c777d 100644 --- a/spec/controllers/hyrax/leases_controller_spec.rb +++ b/spec/controllers/hyrax/leases_controller_spec.rb @@ -18,6 +18,7 @@ it 'shows me the page' do get :index expect(response).to be_success + expect(response).to render_template('dashboard') end end end @@ -34,6 +35,7 @@ it 'shows me the page' do get :edit, params: { id: a_work } expect(response).to be_success + expect(response).to render_template('dashboard') end end end From 9e54d86c34f0f3a6ebb6b33227f6ee1a54c12f6d Mon Sep 17 00:00:00 2001 From: Jennifer Smith Date: Tue, 27 Mar 2018 10:36:41 -0400 Subject: [PATCH 3/5] Add dashboard layout to batch edit and file set edit views --- .../hyrax/batch_edits_controller.rb | 2 + app/controllers/hyrax/file_sets_controller.rb | 12 +++ app/views/hyrax/batch_edits/edit.html.erb | 91 ++++++++++--------- app/views/hyrax/file_sets/edit.html.erb | 44 +++++---- .../hyrax/batch_edits_controller_spec.rb | 1 + .../hyrax/file_sets_controller_spec.rb | 5 + 6 files changed, 91 insertions(+), 64 deletions(-) diff --git a/app/controllers/hyrax/batch_edits_controller.rb b/app/controllers/hyrax/batch_edits_controller.rb index 2b42ffcc25..dfb14253cc 100644 --- a/app/controllers/hyrax/batch_edits_controller.rb +++ b/app/controllers/hyrax/batch_edits_controller.rb @@ -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 diff --git a/app/controllers/hyrax/file_sets_controller.rb b/app/controllers/hyrax/file_sets_controller.rb index 1841c60d06..52ccd383d0 100644 --- a/app/controllers/hyrax/file_sets_controller.rb +++ b/app/controllers/hyrax/file_sets_controller.rb @@ -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 @@ -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 diff --git a/app/views/hyrax/batch_edits/edit.html.erb b/app/views/hyrax/batch_edits/edit.html.erb index 1fd9dacedb..28a7d06665 100644 --- a/app/views/hyrax/batch_edits/edit.html.erb +++ b/app/views/hyrax/batch_edits/edit.html.erb @@ -5,31 +5,32 @@ <%= @form.names.join(", ").html_safe %>
-
+

Descriptions:

- +
-
-
- <% @form.terms.each do |term| %> -
- <%= 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| %> - -
+
+
+
+ <% @form.terms.each do |term| %> +
+ <%= 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| %> + +
<%= hidden_field_tag('update_type', 'update') %> <%= hidden_field_tag('key', term.to_s) %> <%# TODO we don't need to show required %> @@ -42,34 +43,36 @@ Cancel
-
- <% end %> -
- <% end %> -
+
+ <% end %> +
+ <% end %> +
-
- <%= 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 %> +
+ <%= 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 %> -
- <%= f.submit "Save changes", class: 'btn btn-primary', id: 'permissions_save' %> -
+ <% @form.batch_document_ids.each do |batch_id| %> + <%= hidden_field_tag "batch_document_ids[]", batch_id %> + <% end %> +
+ <%= f.submit "Save changes", class: 'btn btn-primary', id: 'permissions_save' %> +
+
+ <% end %>
- <% end %> +
-
+
<%= button_to "Clear Batch", hyrax.clear_batch_edits_path, form_class: 'hidden', remote: true, id: 'clear_batch' %> diff --git a/app/views/hyrax/file_sets/edit.html.erb b/app/views/hyrax/file_sets/edit.html.erb index a2c53f2d8b..8e6a32db88 100644 --- a/app/views/hyrax/file_sets/edit.html.erb +++ b/app/views/hyrax/file_sets/edit.html.erb @@ -8,24 +8,28 @@ <%= media_display curation_concern.to_presenter %>
- -
-
-

Descriptions

- <%= render "form" %> +
+ +
+
+
+

Descriptions

+ <%= render "form" %> +
+ <%= render "permission", file_set: curation_concern %> + <%= render "versioning", file_set: curation_concern %> +
- <%= render "permission", file_set: curation_concern %> - <%= render "versioning", file_set: curation_concern %> -
-
-
+
+
+
\ No newline at end of file diff --git a/spec/controllers/hyrax/batch_edits_controller_spec.rb b/spec/controllers/hyrax/batch_edits_controller_spec.rb index ab53ee2f8d..2733755a7e 100644 --- a/spec/controllers/hyrax/batch_edits_controller_spec.rb +++ b/spec/controllers/hyrax/batch_edits_controller_spec.rb @@ -24,6 +24,7 @@ expect(controller).to receive(:add_breadcrumb).with(I18n.t('hyrax.dashboard.my.works'), Hyrax::Engine.routes.url_helpers.my_works_path(locale: 'en')) get :edit expect(response).to be_successful + expect(response).to render_template('dashboard') expect(assigns[:form].model.creator).to match_array ["Fred", "Wilma"] end end diff --git a/spec/controllers/hyrax/file_sets_controller_spec.rb b/spec/controllers/hyrax/file_sets_controller_spec.rb index fa30c2a61b..90dd8ad313 100644 --- a/spec/controllers/hyrax/file_sets_controller_spec.rb +++ b/spec/controllers/hyrax/file_sets_controller_spec.rb @@ -66,6 +66,7 @@ expect(assigns[:version_list]).to be_kind_of Hyrax::VersionListPresenter expect(assigns[:parent]).to eq parent expect(response).to render_template(:edit) + expect(response).to render_template('dashboard') end end @@ -150,6 +151,7 @@ post :update, params: { id: file_set, revision: version1 } expect(response.code).to eq '401' expect(response).to render_template 'unauthorized' + expect(response).to render_template('dashboard') end end end @@ -196,6 +198,7 @@ post :update, params: { id: file_set, file_set: { keyword: [''] } } expect(response.code).to eq '422' expect(response).to render_template('edit') + expect(response).to render_template('dashboard') expect(assigns[:file_set]).to eq file_set end end @@ -220,6 +223,7 @@ get :edit, params: { id: file_set } expect(response.code).to eq '401' expect(response).to render_template('unauthorized') + expect(response).to render_template('dashboard') end end end @@ -278,6 +282,7 @@ get :edit, params: { id: public_file_set } expect(response.code).to eq '401' expect(response).to render_template(:unauthorized) + expect(response).to render_template('dashboard') end end From 9adb2eb009c3e31105140e6ea875a74a1bf6787c Mon Sep 17 00:00:00 2001 From: Jennifer Smith Date: Tue, 27 Mar 2018 10:49:26 -0400 Subject: [PATCH 4/5] Fix spacing in file sets controller for rubocop --- app/controllers/hyrax/file_sets_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/hyrax/file_sets_controller.rb b/app/controllers/hyrax/file_sets_controller.rb index 52ccd383d0..085f502e8d 100644 --- a/app/controllers/hyrax/file_sets_controller.rb +++ b/app/controllers/hyrax/file_sets_controller.rb @@ -173,10 +173,10 @@ def _prefixes def decide_layout layout = case action_name - when 'show' - '1_column' - else - 'dashboard' + when 'show' + '1_column' + else + 'dashboard' end File.join(theme, layout) end From f9fcbe5a5982055acb10accb70862622a2509c74 Mon Sep 17 00:00:00 2001 From: Jennifer Smith Date: Wed, 28 Mar 2018 10:55:05 -0400 Subject: [PATCH 5/5] Add tests for new breadcrumbs --- .../concerns/hyrax/embargoes_controller_behavior.rb | 9 ++++++++- .../concerns/hyrax/leases_controller_behavior.rb | 9 ++++++++- app/controllers/concerns/hyrax/manages_embargoes.rb | 5 +---- spec/controllers/hyrax/embargoes_controller_spec.rb | 7 +++++++ spec/controllers/hyrax/leases_controller_spec.rb | 9 +++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb index ed0a6211cd..b709194a77 100644 --- a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +++ b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb @@ -7,7 +7,7 @@ module EmbargoesControllerBehavior 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) + add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path authorize! :index, Hydra::AccessControls::Embargo end @@ -43,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 diff --git a/app/controllers/concerns/hyrax/leases_controller_behavior.rb b/app/controllers/concerns/hyrax/leases_controller_behavior.rb index c316cc9642..b6acb590ff 100644 --- a/app/controllers/concerns/hyrax/leases_controller_behavior.rb +++ b/app/controllers/concerns/hyrax/leases_controller_behavior.rb @@ -7,7 +7,7 @@ module LeasesControllerBehavior 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) + add_breadcrumb t(:'hyrax.leases.index.manage_leases'), hyrax.leases_path authorize! :index, Hydra::AccessControls::Lease end @@ -36,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 diff --git a/app/controllers/concerns/hyrax/manages_embargoes.rb b/app/controllers/concerns/hyrax/manages_embargoes.rb index 805c2aeb8b..c471d8f81c 100644 --- a/app/controllers/concerns/hyrax/manages_embargoes.rb +++ b/app/controllers/concerns/hyrax/manages_embargoes.rb @@ -13,9 +13,6 @@ def deny_access(exception) redirect_to root_path, alert: exception.message end - def edit - add_breadcrumb t(:'hyrax.controls.home'), root_path - add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path - end + def edit; end end end diff --git a/spec/controllers/hyrax/embargoes_controller_spec.rb b/spec/controllers/hyrax/embargoes_controller_spec.rb index 79dbfb12d9..d51fa4a5bb 100644 --- a/spec/controllers/hyrax/embargoes_controller_spec.rb +++ b/spec/controllers/hyrax/embargoes_controller_spec.rb @@ -15,6 +15,9 @@ let(:user) { create(:user, groups: ['admin']) } it 'shows me the page' do + expect(controller).to receive(:add_breadcrumb).with('Home', root_path) + expect(controller).to receive(:add_breadcrumb).with('Dashboard', dashboard_path) + expect(controller).to receive(:add_breadcrumb).with('Manage Embargoes', embargoes_path) get :index expect(response).to be_success expect(response).to render_template('dashboard') @@ -32,6 +35,10 @@ end context 'when I have permission to edit the object' do it 'shows me the page' do + expect(controller).to receive(:add_breadcrumb).with('Home', root_path) + expect(controller).to receive(:add_breadcrumb).with('Dashboard', dashboard_path) + expect(controller).to receive(:add_breadcrumb).with('Manage Embargoes', embargoes_path) + expect(controller).to receive(:add_breadcrumb).with('Update Embargo', '#') get :edit, params: { id: a_work } expect(response).to be_success expect(response).to render_template('dashboard') diff --git a/spec/controllers/hyrax/leases_controller_spec.rb b/spec/controllers/hyrax/leases_controller_spec.rb index bffd9c777d..7c6dd18ace 100644 --- a/spec/controllers/hyrax/leases_controller_spec.rb +++ b/spec/controllers/hyrax/leases_controller_spec.rb @@ -16,6 +16,10 @@ let(:user) { create(:user, groups: ['admin']) } it 'shows me the page' do + expect(controller).to receive(:add_breadcrumb).with('Home', root_path) + expect(controller).to receive(:add_breadcrumb).with('Dashboard', dashboard_path) + expect(controller).to receive(:add_breadcrumb).with('Manage Leases', leases_path) + get :index expect(response).to be_success expect(response).to render_template('dashboard') @@ -33,6 +37,11 @@ end context 'when I have permission to edit the object' do it 'shows me the page' do + expect(controller).to receive(:add_breadcrumb).with('Home', root_path) + expect(controller).to receive(:add_breadcrumb).with('Dashboard', dashboard_path) + expect(controller).to receive(:add_breadcrumb).with('Manage Leases', leases_path) + expect(controller).to receive(:add_breadcrumb).with('Update Lease', '#') + get :edit, params: { id: a_work } expect(response).to be_success expect(response).to render_template('dashboard')