add: town square forum config

This commit is contained in:
trisua 2025-08-04 14:58:36 -04:00
parent d4ff681310
commit 548a6dcf4e
8 changed files with 73 additions and 5 deletions

View file

@ -109,6 +109,23 @@
("class" "card flex flex_col gap_2")
("id" "create_form")
("onsubmit" "create_post_from_form(event)")
(text "{% if show_topics -%}")
(div
("class" "flex flex_col gap_1")
(label
("for" "topic")
(str (text "communities:label.topic")))
(select
("id" "topic")
("name" "topic")
(text "{% for id, topic in topics %}")
(option
("value" "{{ id }}")
("selected" "{% if selected_topic|int == id|int -%}true{% else %}false{%- endif %}")
(text "{{ topic.title }}"))
(text "{% endfor %}")))
(text "{%- endif %}")
(div
("class" "flex flex_col gap_1 hidden")
("id" "title_field")
@ -168,8 +185,7 @@
(text "{{ text \"communities:action.create\" }}"))))))
(text "{% if not quoting -%}")
(script
(text "globalThis.SEARCH_PARAMS = new URLSearchParams(window.location.search);
async function create_post_from_form(e) {
(text "async function create_post_from_form(e) {
e.preventDefault();
await trigger(\"atto::debounce\", [\"posts::create\"]);
@ -210,7 +226,7 @@
content: e.target.content.value,
community: !is_selected_stack ? selected_community : \"0\",
stack: is_selected_stack ? selected_community : \"0\",
topic: !is_selected_stack ? SEARCH_PARAMS.get(\"topic\") || \"0\" : \"0\",
topic: e.target.topic.selectedOptions[0].value,
poll: poll_data[1],
title: e.target.title.value,
}),

View file

@ -11,7 +11,7 @@
("class" "flex gap_2")
(text "{% if can_post -%}")
(a
("href" "/communities/intents/post?community={{ community.id }}&topic={{ topic_id }}&sig=true")
("href" "/communities/intents/post?community={{ community.id }}&topic={{ topic_id }}&sig=true&topics=true")
("class" "button small lowered")
("data-turbo" "false")
(icon (text "plus"))

View file

@ -574,6 +574,7 @@
(div
("class" "flex flex_col gap_2")
("style" "flex: 1 0 auto")
(b ("class" "no_p_margin") (text "{{ post.title|markdown|safe }}"))
(span ("class" "no_p_margin") (text "{{ post.content|markdown|safe }}"))
(text "{{ self::post_media(upload_ids=post.uploads) }}")
(text "{% if poll -%} {{ self::poll(post=post, poll=poll) }} {%- endif %}"))

View file

@ -7,6 +7,16 @@
(text "{{ macros::timelines_nav(selected=\"all\", posts=\"/all\", questions=\"/all/questions\", secondary_selected=\"forum_posts\", forum_posts=\"/all/forum_posts\") }}")
(div
("class" "card w_full flex flex_col gap_2")
(text "{% if config.town_square_forum != 0 -%}")
(a
("href" "/communities/intents/post?community={{ config.town_square_forum }}&topic={{ config.town_square_forum_topic }}&sig=true&topics=true")
("class" "button small lowered")
("data-turbo" "false")
(icon (text "plus"))
(span
(str (text "general:action.post"))))
(text "{%- endif %}")
(div
("class" "w_full")
("style" "overflow: auto")