Active checkbox replaced with switch & refresh on new sub

This commit is contained in:
Corban-Lee Jones 2024-04-25 15:04:10 +01:00
parent c4fb8d5c38
commit fcdbf0fde4

View File

@ -47,48 +47,13 @@ function initSubscriptionTable() {
title: "Active",
data: "active",
orderable: false,
className: "text-center",
className: "text-center form-switch",
render: function(data, type) {
return `<input type="checkbox" class="form-check-input mt-0" ${data ? "checked" : ""} />`
return `<input type="checkbox" class="form-check-input m-0" ${data ? "checked" : ""} />`
}
}
]
});
// subTable.rows.add([
// {
// name: "BBC News",
// url: "https://feeds.bbci.co.uk/news/rss.xml",
// channels_count: 3,
// created: "13-03-2024",
// notes: "No Description",
// active: true
// },
// {
// name: "BBC News - Entertainment",
// url: "https://feeds.bbci.co.uk/news/entertainment_and_arts/rss.xml",
// channels_count: 1,
// created: "22-03-2024",
// notes: "No Description",
// active: true
// },
// {
// name: "BBC News - Politics",
// url: "https://feeds.bbci.co.uk/news/politics/rss.xml",
// channels_count: 5,
// created: "16-03-2024",
// notes: "No Description",
// active: true
// },
// {
// name: "BBC News - North America",
// url: "https://feeds.bbci.co.uk/news/north_america/rss.xml",
// channels_count: 2,
// created: "04-04-2024",
// notes: "No Description",
// active: true
// }
// ]).draw(false);
}
// Determine and apply the state of the 'select all' checkbox
@ -150,12 +115,13 @@ $("#subForm").on("submit", async function(event) {
var name = $("#subName").val();
url = $("#subUrl").val();
guildId = $("#subGuildId").val();
guildId = getCurrentlyActiveServer().guild_id;
extraNotes = $("#subExtraNotes").val();
var subPrimaryKey = await registerNewSubscription(name, url, guildId, extraNotes);
if (subPrimaryKey)
showToast("success", "subscription created", "created with ID: " + subPrimaryKey);
await loadSubscriptions(guildId);
$("#subFormModal").modal("hide");
});