fix
This commit is contained in:
parent
f288e826ff
commit
befa8d1e7a
3 changed files with 49 additions and 47 deletions
|
@ -291,16 +291,27 @@ const messageModal = document.getElementById('directMessageModal')
|
|||
|
||||
// When message modal opens
|
||||
messageModal.addEventListener('show.bs.modal', function (event) {
|
||||
// Form that will send the message
|
||||
const form = messageModal.querySelector('form');
|
||||
// Button that triggered the modal
|
||||
const button = event.relatedTarget
|
||||
const button = event.relatedTarget;
|
||||
// Extract info from data-bs-* attributes
|
||||
const recipient = button.getAttribute('data-bs-recipient')
|
||||
const recipient = button.getAttribute('data-bs-recipient');
|
||||
// Update the modal's content.
|
||||
const modalTitle = messageModal.querySelector('.modal-title')
|
||||
//
|
||||
messageModal.querySelector('form').action = `/@${recipient}/message`
|
||||
const modalTitle = messageModal.querySelector('.modal-title');
|
||||
// Set our form's action
|
||||
form.action = `/@${recipient}/message`
|
||||
|
||||
modalTitle.textContent = 'New message to ' + recipient
|
||||
|
||||
form.addEventListener("submit", function(event) {
|
||||
button.disabled = true;
|
||||
button.textContent = button.getAttribute('data-bs-loading');
|
||||
submitFormAjax(event);
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
// When message modal closes
|
||||
|
@ -311,13 +322,4 @@ messageModal.addEventListener('hidden.bs.modal', function (event) {
|
|||
modalBodyInput.value = '';
|
||||
})
|
||||
|
||||
function sendMessage(el) {
|
||||
// Get our input
|
||||
const input = document.getElementById(el)
|
||||
// Extract info from our input
|
||||
const message = input.value;
|
||||
// Send our message
|
||||
postToast(``)
|
||||
}
|
||||
|
||||
// Send coins
|
|
@ -357,7 +357,7 @@
|
|||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
<script src="/static/assets/CHRISTMAS/js/default.js?a=9"></script>
|
||||
<script src="/static/assets/CHRISTMAS/js/default.js?a=10"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Form action loaded by JS -->
|
||||
<form id="message" action="" method="post" enctype="multipart/form-data" onsubmit="submitFormAjax(event)">
|
||||
<form id="message">
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<div class="relative rounded border border-gray-300 dark:border-gray-900 bg-white dark:bg-white/[.05] w-full">
|
||||
<textarea maxlength="1000" id="direct-message-input" name="message" form="message" class="rounded-t bg-transparent p-2 shadow-inner w-full" aria-label="With textarea" placeholder="Write your message..." rows="3"></textarea>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<button type="button" class="px-4 py-2 text-sm font-bold text-gray-500 hover:text-gray-400" data-bs-dismiss="modal">
|
||||
Cancel
|
||||
</button>
|
||||
<button type="submit" form="message" class="btn btn-primary">
|
||||
<button type="submit" form="message" class="btn btn-primary" data-bs-loading="Sending" data-bs-dismiss="modal">
|
||||
Send message
|
||||
</button>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue