add: forum posts ui

This commit is contained in:
trisua 2025-08-03 23:24:57 -04:00
parent ef029c59b3
commit 2be87c397d
90 changed files with 1459 additions and 1299 deletions

View file

@ -39,7 +39,7 @@
("content" "View this post from @{{ owner.username }} on {{ config.name }}!"))
(text "{% endblock %} {% block body %} {{ macros::nav() }}")
(main
("class" "flex flex-col gap-2")
("class" "flex flex_col gap_2 {% if community.is_forum -%}content_container{%- endif %}")
(text "{% if post.replying_to -%}")
(a
("href" "/post/{{ post.replying_to }}")
@ -48,21 +48,29 @@
(span
(text "{{ text \"communities:action.continue_thread\" }}")))
(text "{%- endif %}")
; post
(text "{% if not community.is_forum -%}")
(div
("style" "display: contents;")
("style" "display: contents")
(text "{% if post.context.repost and post.context.repost.reposting -%} {{ components::repost(repost=reposting, post=post, owner=owner, community=community, show_community=true, can_manage_post=can_manage_posts) }} {% else %} {{ components::post(post=post, owner=owner, question=question, community=community, show_community=true, can_manage_post=can_manage_posts, poll=poll, dont_show_title=true) }} {%- endif %}"))
(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 "{%- endif %}")
; ...
(text "{% if user and post.context.comments_enabled -%}")
(div
("class" "card-nest")
("class" "card_nest")
(div
("class" "card small")
(b
(text "{{ text \"communities:label.create_reply\" }}")))
(form
("class" "card flex flex-col gap-2")
("class" "card flex flex_col gap_2")
("onsubmit" "create_reply_from_form(event)")
(div
("class" "flex flex-col gap-1")
("class" "flex flex_col gap_1")
(label
("for" "content")
(text "{{ text \"communities:label.content\" }}"))
@ -75,9 +83,9 @@
("maxlength" "4096")))
(div
("id" "files_list")
("class" "flex gap-2 flex-wrap"))
("class" "flex gap_2 flex_wrap"))
(div
("class" "flex gap-2")
("class" "flex gap_2")
(text "{{ components::emoji_picker(element_id=\"content\", render_dialog=true) }} {% if is_supporter -%} {{ components::file_picker(files_list_id=\"files_list\") }} {% endif %}")
(button
(text "{{ text \"communities:action.create\" }}")))))
@ -124,17 +132,17 @@
(span
(text "{{ text \"communities:action.configure\" }}"))))
(div
("class" "flex flex-col gap-2 hidden")
("class" "flex flex_col gap_2 hidden")
("data-tab" "configure")
(div
("class" "card-nest w-full")
("class" "card_nest w_full")
(div
("class" "card small flex items-center gap-2")
("class" "card small flex items_center gap_2")
(text "{{ icon \"settings\" }}")
(span
(text "{{ text \"communities:action.configure\" }}")))
(div
("class" "card lowered flex flex-col gap-4")
("class" "card lowered flex flex_col gap_4")
("id" "post_context")))
(button
("onclick" "save_context()")
@ -250,18 +258,18 @@
(text "{%- endif %}")
(text "{% if user and user.id == post.owner -%}")
(div
("class" "card-nest w-full hidden")
("class" "card_nest w_full hidden")
("data-tab" "edit")
(div
("class" "card small flex items-center gap-2")
("class" "card small flex items_center gap_2")
(text "{{ icon \"pen\" }}")
(span
(text "{{ text \"communities:label.edit_content\" }}")))
(form
("class" "card flex flex-col gap-2")
("class" "card flex flex_col gap_2")
("onsubmit" "edit_post_from_form(event)")
(div
("class" "flex flex-col gap-1")
("class" "flex flex_col gap_1")
(label
("for" "content")
(text "{{ text \"communities:label.content\" }}"))
@ -275,7 +283,7 @@
("maxlength" "4096")
(text "{{ post.content }}")))
(div
("class" "flex gap-2")
("class" "flex gap_2")
(text "{{ components::emoji_picker(element_id=\"new_content\", render_dialog=false) }}")
(button
(text "{{ text \"general:action.save\" }}")))))
@ -302,16 +310,26 @@
}"))
(text "{%- endif %}")
(div
("class" "card-nest w-full")
("class" "card_nest w_full")
("data-tab" "replies")
(div
("class" "card small flex items-center gap-2")
("class" "card small flex items_center gap_2")
(text "{{ icon \"newspaper\" }}")
(span
(text "{{ text \"communities:label.replies\" }}")))
(div
("class" "card flex flex-col gap-4")
(text "{% for post in replies %} {{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false, poll=post[4]) }} {% endfor %} {{ components::pagination(page=page, items=replies|length) }}"))))
("class" "card flex flex_col gap_4")
(text "{% for post in replies %}")
; reply
(text "{% if not community.is_forum -%}")
(div
("style" "display: contents")
(text "{{ components::post(post=post[0], owner=post[1], question=post[3], secondary=true, show_community=false, poll=post[4]) }}"))
(text "{% else %}")
(div
("style" "display: contents")
(text "{{ components::forum_post(post=post[0], owner=post[1], community=community, can_manage_post=can_manage_posts, poll=post[4]) }}"))
(text "{%- endif %} {% endfor %} {{ components::pagination(page=page, items=replies|length) }}"))))
(script
(text "async function create_reply_from_form(e) {