(text "{% extends \"root.html\" %} {% block head %}") (title (text "File report - {{ config.name }}")) (text "{% endblock %} {% block body %} {{ macros::nav() }}") (main ("class" "flex flex_col gap_2") (div ("class" "card_nest w_full") (div ("class" "card small flex items_center gap_2") (text "{{ icon \"flag\" }}") (span (text "{{ text \"general:label.file_report\" }}"))) (form ("class" "card flex flex_col gap_2") ("onsubmit" "create_report_from_form(event)") (div ("class" "flex flex_col gap_1") (label ("for" "title") (text "{{ text \"communities:label.content\" }}")) (textarea ("type" "text") ("name" "content") ("id" "content") ("placeholder" "content") ("required" "") ("minlength" "16"))) (button (text "{{ text \"communities:action.create\" }}"))))) (script (text "function create_report_from_form(e) { e.preventDefault(); fetch(\"/api/v1/reports\", { method: \"POST\", headers: { \"Content-Type\": \"application/json\", }, body: JSON.stringify({ content: e.target.content.value, asset: \"{{ asset }}\", asset_type: `{{ asset_type }}`, }), }) .then((res) => res.json()) .then((res) => { trigger(\"atto::toast\", [ res.ok ? \"success\" : \"error\", res.message, ]); if (res.ok) { setTimeout(() => { window.close(); }, 150); } }); }")) (text "{% endblock %}")