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:
authorMarin Jankovski <maxlazio@gmail.com>2014-12-26 17:37:04 +0300
committerMarin Jankovski <maxlazio@gmail.com>2014-12-26 17:37:04 +0300
commit16ebeedef225db60e1f62d43e5152a04c29fd289 (patch)
treefb149deb18565b333b4939278705bb4f6487fe63 /app/controllers/projects/protected_branches_controller.rb
parent2cbfc515f22e2064fb29c9cbb8326a132a3515fc (diff)
Update branch status with ajax call.
Diffstat (limited to 'app/controllers/projects/protected_branches_controller.rb')
-rw-r--r--app/controllers/projects/protected_branches_controller.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/app/controllers/projects/protected_branches_controller.rb b/app/controllers/projects/protected_branches_controller.rb
index ac68992faa0..02160d973b3 100644
--- a/app/controllers/projects/protected_branches_controller.rb
+++ b/app/controllers/projects/protected_branches_controller.rb
@@ -22,13 +22,14 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
protected_branch.update_attributes(
developers_can_push: params[:developers_can_push]
)
- flash[:notice] = 'Branch was successfully updated.'
- else
- flash[:alert] = 'Could not update the branch.'
- end
- respond_to do |format|
- format.html { redirect_to project_protected_branches_path }
+ respond_to do |format|
+ format.json { render :json => protected_branch, status: :ok }
+ end
+ else
+ respond_to do |format|
+ format.json { render json: protected_branch.errors, status: :unprocessable_entity }
+ end
end
end