Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Rose <samrose3@gmail.com>2017-05-08 10:41:58 +0300
committerPhil Hughes <me@iamphill.com>2017-05-08 10:41:58 +0300
commit1ebd9dad8e4a3ade4fa829d1d5ac6cbc9825bf48 (patch)
treeea175b4ef388f79d8550a424ac5b46a535555664 /app/controllers/projects/branches_controller.rb
parent1a5e84febeb3f2d63c019981e80c777195c37dd2 (diff)
Add confirm delete protected branch modal
Diffstat (limited to 'app/controllers/projects/branches_controller.rb')
-rw-r--r--app/controllers/projects/branches_controller.rb12
1 files changed, 8 insertions, 4 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