add: forum threads ui

This commit is contained in:
trisua 2025-08-05 16:33:53 -04:00
parent 155fe34c6e
commit 3958d5eaef
8 changed files with 260 additions and 15 deletions

View file

@ -56,7 +56,7 @@
(text "{% else %}")
(div
("style" "display: contents")
(text "{{ components::forum_post(post=post, owner=owner, community=community, can_manage_post=can_manage_posts, poll=poll) }}"))
(text "{{ components::forum_post(post=post, owner=owner, community=community, can_manage_post=can_manage_posts, poll=poll, show_show_thread=false) }}"))
(text "{%- endif %}")
; ...
(text "{% if user and post.context.comments_enabled -%}")
@ -332,7 +332,24 @@
(text "{%- endif %} {% endfor %} {{ components::pagination(page=page, items=replies|length) }}"))))
(script
(text "async function create_reply_from_form(e) {
(text "globalThis.continue_thread = async (target, post_id, id, page = 0) => {
const btn_id = `tmp_${window.crypto.randomUUID()}`;
target.setAttribute(\"disabled\", \"true\");
target.id = btn_id;
document.getElementById(id).innerHTML +=
await (await fetch(`/post/${post_id}/_quick_replies?page=${page}`)).text();
document.getElementById(id).classList.remove(\"hidden\");
await trigger(\"atto::clean_date_codes\");
await trigger(\"atto::link_filter\");
await trigger(\"atto::hooks::check_reactions\");
await trigger(\"atto::hooks::online_indicator\");
document.getElementById(btn_id).parentElement.remove();
}
async function create_reply_from_form(e) {
e.preventDefault();
await trigger(\"atto::debounce\", [\"posts::create\"]);