110 lines
3.6 KiB
Common Lisp
110 lines
3.6 KiB
Common Lisp
(text "{% extends \"root.html\" %} {% block head %}")
|
|
(title
|
|
(text "My services - {{ config.name }}"))
|
|
|
|
(text "{% endblock %} {% block body %} {{ macros::nav() }}")
|
|
(main
|
|
("class" "flex flex_col gap_2")
|
|
|
|
; viewing other user's services warning
|
|
(text "{% if profile.id != user.id -%}")
|
|
(div
|
|
("class" "card w_full red flex gap_2 items_center")
|
|
(text "{{ icon \"skull\" }}")
|
|
(b
|
|
(text "Viewing other user's sites! Please be careful.")))
|
|
(text "{%- endif %}")
|
|
|
|
; ...
|
|
(text "{% if user -%}")
|
|
(div
|
|
("class" "pillmenu")
|
|
(a ("href" "/services") ("class" "active") (str (text "littleweb:label.services")))
|
|
(a ("href" "/domains") (str (text "littleweb:label.domains"))))
|
|
|
|
(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
|
|
(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 "; Updated ")
|
|
(span
|
|
("class" "date")
|
|
(text "{{ item.revision }}"))))
|
|
(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 %}")
|