2014-12-26 09:37:04 -05:00
|
|
|
$ ->
|
2015-03-26 01:45:58 -04:00
|
|
|
$(".protected-branches-list :checkbox").change (e) ->
|
2014-12-26 09:55:58 -05:00
|
|
|
name = $(this).attr("name")
|
|
|
|
if name == "developers_can_push"
|
|
|
|
id = $(this).val()
|
|
|
|
checked = $(this).is(":checked")
|
|
|
|
url = $(this).data("url")
|
|
|
|
$.ajax
|
|
|
|
type: "PUT"
|
|
|
|
url: url
|
|
|
|
dataType: "json"
|
|
|
|
data:
|
|
|
|
id: id
|
|
|
|
developers_can_push: checked
|
2014-12-26 09:37:04 -05:00
|
|
|
|
2014-12-26 09:55:58 -05:00
|
|
|
success: ->
|
2015-03-26 01:45:58 -04:00
|
|
|
row = $(e.target)
|
|
|
|
row.closest('tr').effect('highlight')
|
2014-12-26 09:37:04 -05:00
|
|
|
|
2014-12-26 09:55:58 -05:00
|
|
|
error: ->
|
|
|
|
new Flash("Failed to update branch!", "alert")
|