Port report comment toggle feature to TypeScript

This commit is contained in:
Andreas Nedbal 2022-01-08 02:53:38 +01:00 committed by Andreas Nedbal
parent 9e2a9a2be9
commit 01bedd1143
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,6 @@
export function entryCommentToggle(event: Event): void {
const button = event.target as HTMLButtonElement;
const id = button.dataset.id;
document.querySelector(`#mod-comments-section-${id}`).classList.toggle('d-none');
}

View file

@ -51,5 +51,5 @@
%span{ id: "mod-comment-count-#{report.id}" }= report.moderation_comments.all.count
%button.btn.btn-default.btn-sm{ type: :button, name: 'mod-delete-report', data: { id: report.id } }
%i.fa.fa-trash-o
.card-footer{ id: "mod-comments-section-#{report.id}", style: 'display: none' }
.card-footer.d-none{ id: "mod-comments-section-#{report.id}" }
%div{ id: "mod-comments-#{report.id}" }= render 'moderation/discussion', report: report