reset questionbox character counts after successful submit

This commit is contained in:
Andreas Nedbal 2022-10-31 21:23:22 +01:00
parent 15d05f1699
commit bef1c23a66
2 changed files with 11 additions and 3 deletions

View File

@ -22,6 +22,10 @@ export function questionboxAllHandler(event: Event): void {
if (data.success) {
document.querySelector<HTMLInputElement>('textarea[name=qb-all-question]').value = '';
window['$']('#modal-ask-followers').modal('hide');
// FIXME: also solve this using a Stimulus controller
const characterCount = document.querySelector<HTMLElement>('#modal-ask-followers [data-character-count-max-value]').dataset.characterCountMaxValue;
document.querySelector<HTMLElement>('#modal-ask-followers [data-character-count-target="counter"]').innerHTML = characterCount;
}
showNotification(data.message, data.success);

View File

@ -29,6 +29,10 @@ export function questionboxUserHandler(event: Event): void {
if (data.success) {
document.querySelector<HTMLInputElement>('textarea[name=qb-question]').value = '';
// FIXME: also solve this using a Stimulus controller
const characterCount = document.querySelector<HTMLElement>('#question-box[data-character-count-max-value]').dataset.characterCountMaxValue;
document.querySelector<HTMLElement>('#question-box [data-character-count-target="counter"]').innerHTML = characterCount;
if (promote) {
const questionbox = document.querySelector('#question-box');
questionbox.classList.toggle('d-none');