From b6d47eb3b50cd38a48e80359936eed9d91045611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 11 Jun 2018 12:40:20 +0300 Subject: [PATCH] Generate less HTML to show the channel grid. --- static/js/checks.js | 18 +++++++++++++++++- templates/front/my_checks_desktop.html | 16 ++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) 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 @@
{% spaceless %} {% for channel in channels %} - + {% endfor %} {% endspaceless %}
@@ -155,3 +151,11 @@ {% endfor %} + +{% for channel in channels %} +
+
+{% endfor %}