minecraft_manager/templates/minecraft_manager/modal/delete_attachment.html

48 lines
1.9 KiB
HTML
Raw Normal View History

attachments (#2) Add migration for longer timezone Signed-off-by: Etzelia <etzelia@hotmail.com> Merge branch 'master' of birbmc.com:BirbMC/minecraft_manager into birb # Conflicts: # external/views.py Fix col Signed-off-by: Etzelia <etzelia@hotmail.com> Add attachments, clean up UI, etc. Signed-off-by: Etzelia <etzelia@hotmail.com> Fix Discord embeds (#59) Fix Discord embeds Reviewed-on: https://git.etztech.xyz/MMS/MinecraftManagerDjango/pulls/59 Reviewed-by: ZeroHD <joey@ahines.net> Add requirements (not txt) (#57) Add requirements (not txt) Signed-off-by: Etzelia <etzelia@hotmail.com> Reviewed-on: https://git.etztech.xyz/MMS/MinecraftManagerDjango/pulls/57 Reviewed-by: ZeroHD <joey@ahines.net> Interim Patch (#54) Birb Patches (#1) Birb Patches Signed-off-by: Etzelia <etzelia@hotmail.com> Co-authored-by: Etzelia <etzelia@hotmail.com> Reviewed-by: ZeroHD <joey@ahines.net> Add 'LICENSE' (#53) Add 'LICENSE' Reviewed-by: ZeroHD <joey@ahines.net> Fix captcha and generify community invite (#52) Add validation for final question and some minor CSS Signed-off-by: Etzelia <etzelia@hotmail.com> Change some docs Signed-off-by: Etzelia <etzelia@hotmail.com> Fix captcha and generify community invite Signed-off-by: Etzelia <etzelia@hotmail.com> Co-authored-by: Etzelia <etzelia@hotmail.com> Reviewed-by: ZeroHD <joey@ahines.net> Co-authored-by: Etz Elia <etzelia@hotmail.com> Reviewed-on: https://git.birbmc.com/BirbMC/minecraft_manager/pulls/2 Co-Authored-By: Etzelia <etzelia@hotmail.com> Co-Committed-By: Etzelia <etzelia@hotmail.com>
2021-05-06 17:50:18 +00:00
<div id="deleteAttachmentModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Delete Attachment</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to delete <code id="delete-attachment-name"></code>?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="delete-attachment-confirm">Confirm</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(() => {
const $modal = $('#deleteAttachmentModal');
const deleteAttachmentName = document.querySelector('#delete-attachment-name');
const deleteAttachmentConfirm = document.querySelector('#delete-attachment-confirm');
document.querySelectorAll('.delete-attachment[data-name][data-id]').forEach((elem) => {
elem.addEventListener('click', () => {
deleteAttachmentModal(elem.dataset.name, elem.dataset.id);
});
});
deleteAttachmentConfirm.addEventListener('click', () => {
const attachmentURL = '{% url 'attachment' 0 %}'.replace('0', deleteAttachmentConfirm.dataset.id);
fetch(attachmentURL, {
method: 'DELETE',
headers: {
'X-CSRFToken': '{{ csrf_token }}'
}
}).then(() => {
location.reload();
});
});
function deleteAttachmentModal(name, id) {
deleteAttachmentName.innerHTML = name;
deleteAttachmentConfirm.dataset.id = id;
$modal.modal('show');
}
});
</script>