remove unused extra notes

This commit is contained in:
Corban-Lee Jones 2024-09-29 19:07:27 +01:00
parent 13110044eb
commit 711407bc58

View File

@ -12,7 +12,7 @@ function initSubscriptionsModule() {
{ {
title: "Name", title: "Name",
data: "name", data: "name",
className: "text-truncate", className: "text-truncate col-3",
render: function(data, type, row) { render: function(data, type, row) {
const name = sanitise(data); const name = sanitise(data);
return `<button type="button" class="btn btn-link text-start text-decoration-none edit-modal">${name}</button>`; return `<button type="button" class="btn btn-link text-start text-decoration-none edit-modal">${name}</button>`;
@ -21,7 +21,7 @@ function initSubscriptionsModule() {
{ {
title: "URL", title: "URL",
data: "url", data: "url",
className: "text-truncate", className: "text-truncate col-4",
render: function(data, type) { render: function(data, type) {
const url = sanitise(data); const url = sanitise(data);
return `<a href="${url}" class="btn btn-link text-start text-decoration-none" target="_blank">${url}</a>`; return `<a href="${url}" class="btn btn-link text-start text-decoration-none" target="_blank">${url}</a>`;
@ -30,7 +30,7 @@ function initSubscriptionsModule() {
{ {
title: "Rules", title: "Rules",
data: "unique_rules", data: "unique_rules",
className: "text-center text-nowrap", className: "text-center text-nowrap col-1",
render: function(data, type) { render: function(data, type) {
let badges = $("<div>"); let badges = $("<div>");
data.forEach(function(rule, idx) { data.forEach(function(rule, idx) {
@ -45,6 +45,7 @@ function initSubscriptionsModule() {
{ {
title: "Created At", title: "Created At",
data: "created_at", data: "created_at",
className: "col-3",
render: function(data, type) { render: function(data, type) {
let dateTime = new Date(data); let dateTime = new Date(data);
return $(` return $(`
@ -58,29 +59,11 @@ function initSubscriptionsModule() {
`).popover()[0]; `).popover()[0];
} }
}, },
{
title: "Notes",
data: "extra_notes",
orderable: false,
className: "text-center",
render: function(data, type) {
if (!data) { return "" }
const extraNotes = sanitise(data);
return $(`
<i class="bi bi-chat-left-text"
data-bs-trigger="hover focus"
data-bs-toggle="popover"
data-bs-title="Extra Notes"
data-bs-content="${extraNotes}">
</i>
`).popover()[0];
}
},
{ {
title: "Active", title: "Enabled",
data: "active", data: "active",
orderable: false, orderable: false,
className: "text-center form-switch", className: "text-center form-switch col-1",
render: function(data, type) { render: function(data, type) {
return `<input type="checkbox" class="sub-toggle-active form-check-input ms-0" ${data ? "checked" : ""} />` return `<input type="checkbox" class="sub-toggle-active form-check-input ms-0" ${data ? "checked" : ""} />`
} }
@ -147,11 +130,11 @@ async function openSubModal(id) {
if (type === "checkbox") { if (type === "checkbox") {
$(this).prop("checked", defaultVal === "true"); $(this).prop("checked", defaultVal === "true");
} }
else if ($(this).is("select")) { else if (type === "datetime-local") {
$(this).val(defaultVal).change(); $(this).val(getCurrentDateTime());
} }
else { else {
$(this).val(defaultVal); $(this).val(defaultVal).change();
} }
}); });
} }
@ -159,7 +142,7 @@ async function openSubModal(id) {
$modal.find(".form-create").hide(); $modal.find(".form-create").hide();
$modal.find(".form-edit").show(); $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() { $modal.find("[data-field]").each(function() {
const key = $(this).attr("data-field"); const key = $(this).attr("data-field");
@ -172,7 +155,7 @@ async function openSubModal(id) {
$(this).val(value.split('+')[0].substring(0, 16)); $(this).val(value.split('+')[0].substring(0, 16));
} }
else { else {
$(this).val(value); $(this).val(value).change();
} }
}); });
} }
@ -180,6 +163,7 @@ async function openSubModal(id) {
$modal.modal("show"); $modal.modal("show");
} }
// region Load Modal Options // region Load Modal Options
$(document).on("selectedServerChange", async function() { $(document).on("selectedServerChange", async function() {
@ -187,7 +171,7 @@ $(document).on("selectedServerChange", async function() {
}); });
async function loadMessageStyleOptions() { async function loadMessageStyleOptions() {
let = $input = $(subModalId).find('[data-field="message_style"]'); let $input = $(subModalId).find('[data-field="message_style"]');
// Disable and clear input // Disable and clear input
$input.val("").change(); $input.val("").change();