gitlab-org--gitlab-foss/app/assets/javascripts/protected_branches.js.coffee

22 lines
519 B
CoffeeScript
Raw Normal View History

2014-12-26 14:37:04 +00:00
$ ->
$(":checkbox").change ->
2014-12-26 14:55:58 +00: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 14:37:04 +00:00
2014-12-26 14:55:58 +00:00
success: ->
new Flash("Branch updated.", "notice")
location.reload true
2014-12-26 14:37:04 +00:00
2014-12-26 14:55:58 +00:00
error: ->
new Flash("Failed to update branch!", "alert")