From 1e65e06a0bafb0bd3e6c34b1e5801ca5482eb1e8 Mon Sep 17 00:00:00 2001 From: johndavid400 Date: Mon, 27 May 2019 22:17:30 -0500 Subject: [PATCH 1/3] [BUGFIX] fix undefined method :back in comments_controller redirect --- app/controllers/spree/admin/comments_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/spree/admin/comments_controller.rb b/app/controllers/spree/admin/comments_controller.rb index eab12ee..eea6c88 100644 --- a/app/controllers/spree/admin/comments_controller.rb +++ b/app/controllers/spree/admin/comments_controller.rb @@ -1,7 +1,9 @@ class Spree::Admin::CommentsController < Spree::Admin::ResourceController private - + def location_after_save - :back + # :back is not deprecated in Rails 5, but request.referrer should also work as intended on older versions (confirmed to work on Rails 4 and 5) + request.referrer end -end \ No newline at end of file + +end From 472fdf244fac2ff0eb153b6e478e02f66a3658e1 Mon Sep 17 00:00:00 2001 From: JD Date: Mon, 27 May 2019 22:18:56 -0500 Subject: [PATCH 2/3] fix typo in comment --- app/controllers/spree/admin/comments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/spree/admin/comments_controller.rb b/app/controllers/spree/admin/comments_controller.rb index eea6c88..120a41b 100644 --- a/app/controllers/spree/admin/comments_controller.rb +++ b/app/controllers/spree/admin/comments_controller.rb @@ -2,7 +2,7 @@ class Spree::Admin::CommentsController < Spree::Admin::ResourceController private def location_after_save - # :back is not deprecated in Rails 5, but request.referrer should also work as intended on older versions (confirmed to work on Rails 4 and 5) + # :back is deprecated in Rails 5, but request.referrer should also work as intended on older versions (confirmed to work on Rails 4 and 5) request.referrer end From 2f4f2a9716597e08aa07d2fba3df08a741ee17d4 Mon Sep 17 00:00:00 2001 From: johndavid400 Date: Mon, 16 Sep 2019 21:30:15 -0500 Subject: [PATCH 3/3] only show admin comment menu item if admin --- app/overrides/add_comment_configuration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/overrides/add_comment_configuration.rb b/app/overrides/add_comment_configuration.rb index 25a7637..a82348c 100644 --- a/app/overrides/add_comment_configuration.rb +++ b/app/overrides/add_comment_configuration.rb @@ -1,5 +1,5 @@ Deface::Override.new(:virtual_path => "spree/admin/shared/sub_menu/_configuration", :name => "converted_admin_configurations_menu_468573024", :insert_bottom => "[data-hook='admin_configurations_sidebar_menu']", - :text => "<%= configurations_sidebar_menu_item Spree.t(:comment_types), admin_comment_types_path %>", - :disabled => false) \ No newline at end of file + :text => "<%- if spree_current_user.admin? %><%= configurations_sidebar_menu_item Spree.t(:comment_types), admin_comment_types_path %><% end %>", + :disabled => false)