add emoji button to report modal and award modal

pull/211/head
Aevann 2023-10-06 17:32:40 +03:00
parent eb26034586
commit 9cb397bdf3
5 changed files with 12 additions and 2 deletions

View File

@ -540,12 +540,19 @@ function insertGhostDivs(element) {
const emojiModal = document.getElementById('emojiModal')
function loadEmojis(t, inputTargetIDName)
{
selecting = false;
speed_carot_modal.style.display = "none";
emojiInputTargetDOM = document.getElementById(inputTargetIDName);
if (t.dataset.previousModal) {
emojiModal.addEventListener('hide.bs.modal', () => {
bootstrap.Modal.getOrCreateInstance(document.getElementById(t.dataset.previousModal)).show()
}, {once : true});
}
emojiModal.addEventListener('hide.bs.modal', () => {
setTimeout(() => {
emojiInputTargetDOM.focus();

View File

@ -794,6 +794,7 @@
<h6>We're sorry something here is wrong.</h6>
<small class="form-text text-muted mb-1">Please enter a reason for reporting below.</small>
<input autocomplete="off" maxlength="100" id="reason_comment" class="allow-emojis form-control">
{{macros.emoji_btn('reason_comment', 'reportCommentModal')}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>

View File

@ -56,6 +56,7 @@
<div id="note_section">
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
<textarea autocomplete="off" id="note" maxlength="200" class="form-control" placeholder="Note to include in award notification..."></textarea>
{{macros.emoji_btn('note', 'awardModal')}}
</div>
<input autocomplete="off" id="giveaward" class="awardbtn btn btn-primary mt-3 fl-r" type="submit" data-nonce="{{g.nonce}}" data-onclick="giveaward(this)" value="Give Award" data-bs-dismiss="modal" disabled>

View File

@ -11,6 +11,7 @@
<h6>We're sorry something here is wrong.</h6>
<small class="form-text text-muted">Please enter a reason for reporting below.</small>
<input autocomplete="off" maxlength="100" id="reason_post" class="allow-emojis form-control b2 mt-1">
{{macros.emoji_btn('reason_post', 'reportPostModal')}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>

View File

@ -108,8 +108,8 @@
{% macro emoji_btn(textarea_id) %}
<button type="button" class="btn btn-secondary format m-0 mr-1" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('{{textarea_id}}')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji">
{% macro emoji_btn(textarea_id, previous_modal) %}
<button type="button" class="btn btn-secondary format m-0 mr-1" data-nonce="{{g.nonce}}" data-onclick="loadEmojis(this, '{{textarea_id}}')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji" {% if previous_modal %}data-previous-modal="{{previous_modal}}"{% endif %}>
<i class="fas fa-smile-beam"></i>
</button>
{% endmacro %}