63 lines
1.9 KiB
Common Lisp
63 lines
1.9 KiB
Common Lisp
|
(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 %}")
|