79 lines
2.6 KiB
Common Lisp
79 lines
2.6 KiB
Common Lisp
(text "{% extends \"root.html\" %} {% block head %}")
|
|
(title
|
|
(text "My stacks - {{ config.name }}"))
|
|
|
|
(text "{% endblock %} {% block body %} {{ macros::nav() }}")
|
|
(main
|
|
("class" "flex flex-col gap-2")
|
|
(text "{{ macros::timelines_nav(selected=\"stacks\") }} {% if user -%}")
|
|
(div
|
|
("class" "card-nest")
|
|
(div
|
|
("class" "card small")
|
|
(b
|
|
(text "{{ text \"stacks:label.create_new\" }}")))
|
|
(form
|
|
("class" "card flex flex-col gap-2")
|
|
("onsubmit" "create_stack_from_form(event)")
|
|
(div
|
|
("class" "flex flex-col gap-1")
|
|
(label
|
|
("for" "name")
|
|
(text "{{ text \"communities:label.name\" }}"))
|
|
(input
|
|
("type" "text")
|
|
("name" "name")
|
|
("id" "name")
|
|
("placeholder" "name")
|
|
("required" "")
|
|
("minlength" "2")
|
|
("maxlength" "32")))
|
|
(button
|
|
("class" "primary")
|
|
(text "{{ text \"communities:action.create\" }}"))))
|
|
(text "{%- endif %}")
|
|
(div
|
|
("class" "card-nest w-full")
|
|
(div
|
|
("class" "card small flex items-center justify-between gap-2")
|
|
(div
|
|
("class" "flex items-center gap-2")
|
|
(text "{{ icon \"layers\" }}")
|
|
(span
|
|
(text "{{ text \"stacks:label.my_stacks\" }}"))))
|
|
(div
|
|
("class" "card flex flex-col gap-2")
|
|
(text "{% for item in list %}")
|
|
(text "{{ components::stack_listing(stack=item) }}")
|
|
(text "{% endfor %}"))))
|
|
|
|
(script
|
|
(text "async function create_stack_from_form(e) {
|
|
e.preventDefault();
|
|
await trigger(\"atto::debounce\", [\"stacks::create\"]);
|
|
|
|
fetch(\"/api/v1/stacks\", {
|
|
method: \"POST\",
|
|
headers: {
|
|
\"Content-Type\": \"application/json\",
|
|
},
|
|
body: JSON.stringify({
|
|
name: e.target.name.value,
|
|
}),
|
|
})
|
|
.then((res) => res.json())
|
|
.then((res) => {
|
|
trigger(\"atto::toast\", [
|
|
res.ok ? \"success\" : \"error\",
|
|
res.message,
|
|
]);
|
|
|
|
if (res.ok) {
|
|
setTimeout(() => {
|
|
window.location.href = `/stacks/${res.payload}`;
|
|
}, 100);
|
|
}
|
|
});
|
|
}"))
|
|
|
|
(text "{% endblock %}")
|