confirm delete method
This commit is contained in:
parent
40bca25732
commit
0d9356000e
@ -162,6 +162,37 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="subDeleteModal" class="modal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content rounded-3 bd">
|
||||
<div class="modal-header px-4 py-3">
|
||||
<h5 class="modal-title">Delete Subscription</h5>
|
||||
</div>
|
||||
<div class="modal-body px-4 py-3">
|
||||
<p class="mb-3">
|
||||
The following subscriptions will be permanently deleted, do you want to continue?
|
||||
</p>
|
||||
<p class="mb-0">To be erased:</p>
|
||||
<ul class="mb-0 text-danger">
|
||||
<li>
|
||||
<span class="del-sub-name"></span> (<span class="del-sub-uuid"></span>)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-footer px-4 py-3">
|
||||
<button class="del-sub-confirm btn bg-body-tertiary rounded-3 waves-effect bd" onclick="alert('no sub selected');">
|
||||
<i class="bi bi-check me-1`"></i>
|
||||
Yes, Delete!
|
||||
</button>
|
||||
<button class="btn bg-body-tertiary rounded-3 waves-effect bd ms-3" data-bs-dismiss="modal">
|
||||
<i class="bi bi-x me-1`"></i>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
<!-- Specific Page JS goes HERE -->
|
||||
@ -190,7 +221,7 @@
|
||||
<div class="peer peer-greed" data-bs-toggle="tooltip" data-bs-title="Channels">
|
||||
<!-- channels -->
|
||||
<i class="bi bi-hash me-1"></i>
|
||||
<span>1</span>
|
||||
<span class="sub-channel-count"></span>
|
||||
</div>
|
||||
<div class="peer peer-greed" data-bs-toggle="tooltip" data-bs-title="Tracked Items">
|
||||
<!-- tracked -->
|
||||
@ -239,6 +270,7 @@
|
||||
template.find(".sub-uuid").text(data.uuid);
|
||||
template.find(".sub-rss").text(data.rss_url).attr("href", data.rss_url);
|
||||
template.find(".sub-img").attr("src", data.image);
|
||||
template.find(".sub-channel-count").text(data.targets.split(";").length);
|
||||
|
||||
// Display Sub Description
|
||||
if (!data.extra_notes) {
|
||||
@ -253,7 +285,7 @@
|
||||
|
||||
// Provide button functionality
|
||||
template.find(".sub-edit").attr("onclick", `subEditModal("${data.uuid}");`);
|
||||
template.find(".sub-delete").attr("onclick", `unsubscribe("${data.uuid}");`);
|
||||
template.find(".sub-delete").attr("onclick", `confirmUnsubscribe("${data.uuid}");`);
|
||||
|
||||
// Enable tooltips
|
||||
template.find('[data-bs-toggle="tooltip"]').tooltip();
|
||||
@ -265,7 +297,7 @@
|
||||
formData.append("active", $(this).prop("checked"));
|
||||
|
||||
patchSubscription(data.uuid, formData).then(function(resp) {
|
||||
console.debug("active flag changed successfully")
|
||||
console.debug("active flag changed successfully");
|
||||
})
|
||||
});
|
||||
|
||||
@ -302,7 +334,7 @@
|
||||
|
||||
function loadChannels(guildID) {
|
||||
$("#editSubChannels").empty();
|
||||
$("#editSubChannels").val([]);
|
||||
$("#editSubChannels").val(null);
|
||||
$.ajax({
|
||||
url: `/channels?guild=${guildID}`,
|
||||
type: "GET",
|
||||
@ -361,6 +393,14 @@
|
||||
});
|
||||
}
|
||||
|
||||
function confirmUnsubscribe(uuid) {
|
||||
var title = $(`.sub-item[data-uuid='${uuid}'] .sub-name`).text();
|
||||
$(".del-sub-name").text(title);
|
||||
$(".del-sub-uuid").text(uuid);
|
||||
$(".del-sub-confirm").attr("onclick", `unsubscribe("${uuid}")`)
|
||||
$("#subDeleteModal").modal("show");
|
||||
}
|
||||
|
||||
function unsubscribe(uuid) {
|
||||
var subElem = $(`#subscriptionContainer .sub-item[data-uuid="${uuid}"]`);
|
||||
subElem.find("button").prop("disabled", true);
|
||||
@ -368,6 +408,7 @@
|
||||
deleteSubscription(uuid).then(resp => {
|
||||
subElem.parent().remove();
|
||||
updateSubscriptionCount(-1);
|
||||
$("#subDeleteModal").modal("hide");
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user