minecraft_manager/templates/minecraft_manager/modal/add_attachment.html

47 lines
1.8 KiB
HTML
Raw Permalink 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="addAttachmentModal" 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">Add Attachment(s)</h4>
</div>
<div class="modal-body">
<form method="post" id="add-attachment-form" enctype="multipart/form-data">{% csrf_token %}
<input type="file" multiple name="attachments"/>
<input type="hidden" name="next" value="{% url 'note_info' note.id %}"/>
</form>
</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="add-attachment-save">Save</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(() => {
const $modal = $('#addAttachmentModal');
const addAttachmentSave = document.querySelector('#add-attachment-save');
const addAttachmentForm = document.querySelector('#add-attachment-form');
document.querySelectorAll('.add-attachment[data-model][data-ref]').forEach((elem) => {
elem.addEventListener('click', () => {
addAttachmentModal(elem.dataset.model, elem.dataset.ref);
});
});
$modal.on('hidden.bs.modal', () => {
addAttachmentForm.reset();
});
addAttachmentSave.addEventListener('click', () => {
addAttachmentForm.submit();
});
function addAttachmentModal(model, ref) {
addAttachmentForm.action = '{% url 'attachment_add' 'X' 0 %}'
.replace('X', model)
.replace('0', ref);
$modal.modal('show');
}
});
</script>