mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 21:33:41 -05:00
implement a nasty hack to fix a bug
This commit is contained in:
parent
ea2378fac7
commit
98d8b9e9fe
1 changed files with 6 additions and 3 deletions
|
@ -170,7 +170,7 @@
|
|||
{% else %}
|
||||
<li><button class="dropdown-item" hx-post="{{ url_for('api.unpinQuestion', question_id=item.question.id) }}" hx-target="#top-response-container" hx-swap="none"><i class="bi bi-pin-angle me-1"></i> Unpin</button></li>
|
||||
{% endif %}
|
||||
<li><button class="bg-hover-danger text-danger dropdown-item" hx-post="{{ url_for('api.returnToInbox', question_id=item.question.id) }}" hx-target="#question-{{ item.question.id }}" hx-swap="none"><i class="bi bi-arrow-return-left me-1"></i> Return to inbox</button></li>
|
||||
<li><button class="bg-hover-danger text-danger dropdown-item" hx-post="{{ url_for('api.returnToInbox', question_id=item.question.id) }}" hx-target="#top-response-container" hx-swap="none" data-returntoinbox data-target="question-{{ item.question.id }}"><i class="bi bi-arrow-return-left me-1"></i> Return to inbox</button></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -292,9 +292,12 @@
|
|||
const parsed = JSON.parse(jsonResponse);
|
||||
const alertType = event.detail.successful ? 'success' : 'danger';
|
||||
msgType = event.detail.successful ? parsed.message : parsed.error;
|
||||
const targetElementId = event.detail.target.id;
|
||||
let targetElementId = event.detail.target.id;
|
||||
if (targetElementId != "question-count") {
|
||||
if (document.getElementById(targetElementId) && targetElementId.includes("question-")) {
|
||||
// WARNING: HACK
|
||||
// we use this hack to avoid triggering the event listener twice when making a request to api.returnToInbox
|
||||
if (document.getElementById(targetElementId) && event.detail.requestConfig.elt.dataset.returntoinbox === "") {
|
||||
targetElementId = event.detail.requestConfig.elt.dataset.target;
|
||||
document.getElementById(targetElementId).outerHTML = '';
|
||||
}
|
||||
if (msgType) {
|
||||
|
|
Loading…
Add table
Reference in a new issue