debian-mirror-gitlab/app/assets/javascripts/protected_branches.js.coffee

23 lines
602 B
CoffeeScript
Raw Normal View History

2015-04-26 12:48:37 +05:30
$ ->
$(".protected-branches-list :checkbox").change (e) ->
name = $(this).attr("name")
2016-08-24 12:49:21 +05:30
if name == "developers_can_push" || name == "developers_can_merge"
2015-04-26 12:48:37 +05:30
id = $(this).val()
2016-08-24 12:49:21 +05:30
can_push = $(this).is(":checked")
2015-04-26 12:48:37 +05:30
url = $(this).data("url")
$.ajax
2016-08-24 12:49:21 +05:30
type: "PATCH"
2015-04-26 12:48:37 +05:30
url: url
dataType: "json"
data:
id: id
2016-08-24 12:49:21 +05:30
protected_branch:
"#{name}": can_push
2015-04-26 12:48:37 +05:30
success: ->
row = $(e.target)
row.closest('tr').effect('highlight')
error: ->
new Flash("Failed to update branch!", "alert")