2025-07-07 16:32:18 -04:00
|
|
|
(text "{% extends \"root.html\" %} {% block head %}")
|
|
|
|
(title
|
2025-07-08 13:35:23 -04:00
|
|
|
(text "My services - {{ config.name }}"))
|
2025-07-07 16:32:18 -04:00
|
|
|
|
|
|
|
(text "{% endblock %} {% block body %} {{ macros::nav() }}")
|
|
|
|
(main
|
|
|
|
("class" "flex flex-col gap-2")
|
2025-07-08 13:35:23 -04:00
|
|
|
(text "{% if user -%}")
|
|
|
|
(div
|
|
|
|
("class" "pillmenu")
|
|
|
|
(a ("href" "/services") ("class" "active") (str (text "littleweb:label.services")))
|
|
|
|
(a ("href" "/domains") (str (text "littleweb:label.domains"))))
|
|
|
|
|
2025-07-07 16:32:18 -04:00
|
|
|
(div
|
|
|
|
("class" "card-nest")
|
|
|
|
(div
|
|
|
|
("class" "card small")
|
|
|
|
(b
|
|
|
|
(str (text "littleweb:label.create_new"))))
|
|
|
|
(form
|
|
|
|
("class" "card flex flex-col gap-2")
|
|
|
|
("onsubmit" "create_service_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")
|
|
|
|
(icon (text "panel-top"))
|
|
|
|
(span
|
|
|
|
(str (text "littleweb:label.my_services")))))
|
|
|
|
(div
|
|
|
|
("class" "card flex flex-col gap-2")
|
|
|
|
(text "{% for item in list %}")
|
|
|
|
(a
|
|
|
|
("href" "/services/{{ item.id }}")
|
|
|
|
("class" "card secondary flex flex-col gap-2")
|
|
|
|
(div
|
|
|
|
("class" "flex items-center gap-2")
|
|
|
|
(icon (text "globe"))
|
|
|
|
(b
|
|
|
|
(text "{{ item.name }}")))
|
|
|
|
(span
|
|
|
|
(text "Created ")
|
|
|
|
(span
|
|
|
|
("class" "date")
|
|
|
|
(text "{{ item.created }}"))
|
|
|
|
(text "; {{ item.files|length }} files")))
|
|
|
|
(text "{% endfor %}"))))
|
|
|
|
|
|
|
|
(script
|
|
|
|
(text "async function create_service_from_form(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
await trigger(\"atto::debounce\", [\"services::create\"]);
|
|
|
|
|
|
|
|
fetch(\"/api/v1/services\", {
|
|
|
|
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 = `/services/${res.payload}`;
|
|
|
|
}, 100);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}"))
|
|
|
|
|
|
|
|
(text "{% endblock %}")
|