diff --git a/static/js/checks.js b/static/js/checks.js index f9237fe8..3c1dd600 100644 --- a/static/js/checks.js +++ b/static/js/checks.js @@ -175,11 +175,27 @@ $(function () { return false; }); + $(".integrations").tooltip({ + container: "body", + selector: "img", + title: function() { + var idx = $(this).index(); + return $("#ch-" + idx).data("title"); + } + }); + $(".integrations").on("click", "img", function() { var isOff = $(this).toggleClass("off").hasClass("off"); var token = $('input[name=csrfmiddlewaretoken]').val(); + + var idx = $(this).index(); + var checkCode = $(this).closest("tr").data("code"); + var channelCode = $("#ch-" + idx).data("code"); + + var url = "/checks/" + checkCode + "/channels/" + channelCode + "/enabled"; + $.ajax({ - url: this.dataset.url, + url: url, type: "post", headers: {"X-CSRFToken": token}, data: {"state": isOff ? "off" : "on"} diff --git a/templates/front/my_checks_desktop.html b/templates/front/my_checks_desktop.html index 500577a6..78a0fb34 100644 --- a/templates/front/my_checks_desktop.html +++ b/templates/front/my_checks_desktop.html @@ -80,12 +80,8 @@