diff --git a/crates/app/src/public/html/communities/question.html b/crates/app/src/public/html/communities/question.html index 46e5e38..8644251 100644 --- a/crates/app/src/public/html/communities/question.html +++ b/crates/app/src/public/html/communities/question.html @@ -33,9 +33,18 @@ > - +
+ +
+ {{ components::emoji_picker(element_id="content", + render_dialog=true) }} {% if is_supporter %} {{ + components::file_picker(files_list_id="files_list") }} {% endif + %} + + +
{% endif %} @@ -62,16 +71,29 @@ window.answer_question_from_form = async (e, answering) => { e.preventDefault(); await trigger("atto::debounce", ["posts::create"]); - fetch("/api/v1/posts", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ + + // create body + const body = new FormData(); + + if (e.target.file_picker) { + for (const file of e.target.file_picker.files) { + body.append(file.name, file); + } + } + + body.append( + "body", + JSON.stringify({ content: e.target.content.value, community: community ? community : "{{ config.town_square }}", answering, }), + ); + + // ... + fetch("/api/v1/posts", { + method: "POST", + body, }) .then((res) => res.json()) .then((res) => {