diff options
author | Sam Rose <samrose3@gmail.com> | 2017-05-08 07:41:58 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-08 07:41:58 +0000 |
commit | 1ebd9dad8e4a3ade4fa829d1d5ac6cbc9825bf48 (patch) | |
tree | ea175b4ef388f79d8550a424ac5b46a535555664 /app/controllers | |
parent | 1a5e84febeb3f2d63c019981e80c777195c37dd2 (diff) | |
download | gitlab-ce-1ebd9dad8e4a3ade4fa829d1d5ac6cbc9825bf48.tar.gz |
Add confirm delete protected branch modal
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/branches_controller.rb | 12 | ||||
-rw-r--r-- | app/controllers/projects/tags_controller.rb | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index f0f031303d8..59247280559 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -73,13 +73,17 @@ class Projects::BranchesController < Projects::ApplicationController def destroy @branch_name = Addressable::URI.unescape(params[:id]) - status = DeleteBranchService.new(project, current_user).execute(@branch_name) + result = DeleteBranchService.new(project, current_user).execute(@branch_name) + respond_to do |format| format.html do - redirect_to namespace_project_branches_path(@project.namespace, - @project), status: 303 + flash_type = result[:status] == :error ? :alert : :notice + flash[flash_type] = result[:message] + + redirect_to namespace_project_branches_path(@project.namespace, @project), status: 303 end - format.js { render nothing: true, status: status[:return_code] } + + format.js { render nothing: true, status: result[:return_code] } end end diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index e13f0bde315..750c3ec486a 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -48,7 +48,7 @@ class Projects::TagsController < Projects::ApplicationController respond_to do |format| if result[:status] == :success format.html do - redirect_to namespace_project_tags_path(@project.namespace, @project) + redirect_to namespace_project_tags_path(@project.namespace, @project), status: 303 end format.js @@ -57,7 +57,7 @@ class Projects::TagsController < Projects::ApplicationController format.html do redirect_to namespace_project_tags_path(@project.namespace, @project), - alert: @error + alert: @error, status: 303 end format.js do |