diff --git a/crates/app/src/public/html/misc/requests.html b/crates/app/src/public/html/misc/requests.html index c991d00..ca3e46f 100644 --- a/crates/app/src/public/html/misc/requests.html +++ b/crates/app/src/public/html/misc/requests.html @@ -108,7 +108,14 @@ > +
+
+ {{ components::emoji_picker(element_id="content", + render_dialog=true) }} {% if is_supporter %} {{ + components::file_picker(files_list_id="files_list") }} + {% endif %} + @@ -166,16 +173,30 @@ 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: "{{ config.town_square }}", answering, }), + ); + + // ... + fetch("/api/v1/posts", { + method: "POST", + + body, }) .then((res) => res.json()) .then((res) => { diff --git a/crates/app/src/public/html/post/post.html b/crates/app/src/public/html/post/post.html index f6d7d2c..2137ae9 100644 --- a/crates/app/src/public/html/post/post.html +++ b/crates/app/src/public/html/post/post.html @@ -43,9 +43,13 @@ >
+
+
{{ components::emoji_picker(element_id="content", - render_dialog=true) }} + render_dialog=true) }} {% if is_supporter %} {{ + components::file_picker(files_list_id="files_list") }} {% endif + %}