From 75b0ef82ba81ae6892cb14756fee2500b8b2d56f Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Fri, 29 Aug 2014 15:56:26 -0700 Subject: Fine-tune the Remove Project redirect. Now it redirects to admin_projects_path and shows a flash message confirming the action has been taken. --- app/controllers/projects_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f23afaf28fa..42f3d901eab 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -103,7 +103,10 @@ class ProjectsController < ApplicationController ::Projects::DestroyService.new(@project, current_user, {}).execute respond_to do |format| - format.html { redirect_to root_path } + format.html do + flash[:alert] = "Project deleted." + redirect_to admin_projects_path + end end end -- cgit v1.2.1 From 893bd8aceca731ebe3124cebe6c7a09adc17b971 Mon Sep 17 00:00:00 2001 From: Kevin Boyd Date: Fri, 5 Sep 2014 22:35:46 +0000 Subject: Incorporating Dmitriy's referrer-based routing suggestion --- app/controllers/projects_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 42f3d901eab..b3380a6ff23 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -105,7 +105,12 @@ class ProjectsController < ApplicationController respond_to do |format| format.html do flash[:alert] = "Project deleted." - redirect_to admin_projects_path + + if request.referer.include?("/admin") + redirect_to admin_projects_path + else + redirect_to projects_dashboard_path + end end end end -- cgit v1.2.1