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"))