From 9ae4c17cb1fde0eaa1556e545a8871b6a70d2efa Mon Sep 17 00:00:00 2001 From: David Svantesson Date: Sat, 9 Nov 2019 01:39:37 +0100 Subject: Allow to add and remove all repositories to/from team. (#8867) * Allow to add and remove all repositories to team. * Change style, buttons on same row. * Apply suggestions from code review Grammar Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Move set num repos to lower function. * Make general language sentences --- public/js/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'public/js') diff --git a/public/js/index.js b/public/js/index.js index 53650890f0..93ac6a2178 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2263,6 +2263,7 @@ $(document).ready(function () { // Helpers. $('.delete-button').click(showDeletePopup); + $('.add-all-button').click(showAddAllPopup); $('.delete-branch-button').click(showDeletePopup); @@ -2501,6 +2502,35 @@ function showDeletePopup() { return false; } +function showAddAllPopup() { + const $this = $(this); + let filter = ""; + if ($this.attr("id")) { + filter += "#" + $this.attr("id") + } + + const dialog = $('.addall.modal' + filter); + dialog.find('.name').text($this.data('name')); + + dialog.modal({ + closable: false, + onApprove: function() { + if ($this.data('type') == "form") { + $($this.data('form')).submit(); + return; + } + + $.post($this.data('url'), { + "_csrf": csrf, + "id": $this.data("id") + }).done(function(data) { + window.location.href = data.redirect; + }); + } + }).modal('show'); + return false; +} + function initVueComponents(){ const vueDelimeters = ['${', '}']; -- cgit v1.2.3