From 711407bc585f1217359d639193c0ef0dd6e37ab4 Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Sun, 29 Sep 2024 19:07:27 +0100 Subject: [PATCH] remove unused extra notes --- apps/home/static/home/js/tabs/subs.js | 42 +++++++++------------------ 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/apps/home/static/home/js/tabs/subs.js b/apps/home/static/home/js/tabs/subs.js index 8d7c94d..ea83b97 100644 --- a/apps/home/static/home/js/tabs/subs.js +++ b/apps/home/static/home/js/tabs/subs.js @@ -12,7 +12,7 @@ function initSubscriptionsModule() { { title: "Name", data: "name", - className: "text-truncate", + className: "text-truncate col-3", render: function(data, type, row) { const name = sanitise(data); return ``; @@ -21,7 +21,7 @@ function initSubscriptionsModule() { { title: "URL", data: "url", - className: "text-truncate", + className: "text-truncate col-4", render: function(data, type) { const url = sanitise(data); return `${url}`; @@ -30,7 +30,7 @@ function initSubscriptionsModule() { { title: "Rules", data: "unique_rules", - className: "text-center text-nowrap", + className: "text-center text-nowrap col-1", render: function(data, type) { let badges = $("
"); data.forEach(function(rule, idx) { @@ -45,6 +45,7 @@ function initSubscriptionsModule() { { title: "Created At", data: "created_at", + className: "col-3", render: function(data, type) { let dateTime = new Date(data); return $(` @@ -58,29 +59,11 @@ function initSubscriptionsModule() { `).popover()[0]; } }, - { - title: "Notes", - data: "extra_notes", - orderable: false, - className: "text-center", - render: function(data, type) { - if (!data) { return "" } - const extraNotes = sanitise(data); - return $(` - - - `).popover()[0]; - } - }, { - title: "Active", + title: "Enabled", data: "active", orderable: false, - className: "text-center form-switch", + className: "text-center form-switch col-1", render: function(data, type) { return `` } @@ -147,11 +130,11 @@ async function openSubModal(id) { if (type === "checkbox") { $(this).prop("checked", defaultVal === "true"); } - else if ($(this).is("select")) { - $(this).val(defaultVal).change(); + else if (type === "datetime-local") { + $(this).val(getCurrentDateTime()); } else { - $(this).val(defaultVal); + $(this).val(defaultVal).change(); } }); } @@ -159,7 +142,7 @@ async function openSubModal(id) { $modal.find(".form-create").hide(); $modal.find(".form-edit").show(); - let data = await ajaxRequest(`/api/subscriptions/${id}/`, "GET"); + const data = await ajaxRequest(`/api/subscriptions/${id}/`, "GET"); $modal.find("[data-field]").each(function() { const key = $(this).attr("data-field"); @@ -172,7 +155,7 @@ async function openSubModal(id) { $(this).val(value.split('+')[0].substring(0, 16)); } else { - $(this).val(value); + $(this).val(value).change(); } }); } @@ -180,6 +163,7 @@ async function openSubModal(id) { $modal.modal("show"); } + // region Load Modal Options $(document).on("selectedServerChange", async function() { @@ -187,7 +171,7 @@ $(document).on("selectedServerChange", async function() { }); async function loadMessageStyleOptions() { - let = $input = $(subModalId).find('[data-field="message_style"]'); + let $input = $(subModalId).find('[data-field="message_style"]'); // Disable and clear input $input.val("").change();