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
path: root/app
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-06-24 08:43:02 +0300
committerTimothy Andrew <mail@timothyandrew.net>2016-07-13 10:54:56 +0300
commit959d63ab1a5559f5f60ba7378a59e2d0fdb17c73 (patch)
treecbcc94bdbc3b91ace2f0832892706ba4fc3abfde /app
parent60245bbe228014a9f689adafd64b571883ef6eb3 (diff)
Clean up `protected_branches.js.coffee`
- Only send a param for the currently changed checkbox. - Have the controller use strong parameters correctly, so that the PATCH works as expected.
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/protected_branches.js.coffee9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/assets/javascripts/protected_branches.js.coffee b/app/assets/javascripts/protected_branches.js.coffee
index ce2fc883620..14afef2e2ee 100644
--- a/app/assets/javascripts/protected_branches.js.coffee
+++ b/app/assets/javascripts/protected_branches.js.coffee
@@ -1,21 +1,18 @@
$ ->
$(".protected-branches-list :checkbox").change (e) ->
name = $(this).attr("name")
- row = $(this).parents("tr")
if name == "developers_can_push" || name == "developers_can_merge"
id = $(this).val()
- can_push = row.find("input[name=developers_can_push]").is(":checked")
- can_merge = row.find("input[name=developers_can_merge]").is(":checked")
+ can_push = $(this).is(":checked")
url = $(this).data("url")
$.ajax
- type: "PUT"
+ type: "PATCH"
url: url
dataType: "json"
data:
id: id
protected_branch:
- developers_can_push: can_push
- developers_can_merge: can_merge
+ "#{name}": can_push
success: ->
row = $(e.target)