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:
Diffstat (limited to 'app/assets/javascripts/protected_branches.js')
-rw-r--r--app/assets/javascripts/protected_branches.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/assets/javascripts/protected_branches.js b/app/assets/javascripts/protected_branches.js
new file mode 100644
index 00000000000..db21a19964d
--- /dev/null
+++ b/app/assets/javascripts/protected_branches.js
@@ -0,0 +1,35 @@
+(function() {
+ $(function() {
+ return $(".protected-branches-list :checkbox").change(function(e) {
+ var can_push, id, name, obj, url;
+ name = $(this).attr("name");
+ if (name === "developers_can_push" || name === "developers_can_merge") {
+ id = $(this).val();
+ can_push = $(this).is(":checked");
+ url = $(this).data("url");
+ return $.ajax({
+ type: "PATCH",
+ url: url,
+ dataType: "json",
+ data: {
+ id: id,
+ protected_branch: (
+ obj = {},
+ obj["" + name] = can_push,
+ obj
+ )
+ },
+ success: function() {
+ var row;
+ row = $(e.target);
+ return row.closest('tr').effect('highlight');
+ },
+ error: function() {
+ return new Flash("Failed to update branch!", "alert");
+ }
+ });
+ }
+ });
+ });
+
+}).call(this);