147 lines
5.5 KiB
Common Lisp
147 lines
5.5 KiB
Common Lisp
(text "{% extends \"root.html\" %} {% block head %}")
|
|
(title
|
|
(text "Developer panel - {{ config.name }}"))
|
|
|
|
(text "{% endblock %} {% block body %} {{ macros::nav(selected=\"\") }}")
|
|
(main
|
|
("class" "flex flex-col gap-2")
|
|
; create new
|
|
(text "{{ components::supporter_ad(body=\"Become a supporter to create multiple apps!\") }}")
|
|
|
|
(div
|
|
("class" "card-nest")
|
|
(div
|
|
("class" "card small")
|
|
(b
|
|
(text "{{ text \"developer:label.create_new\" }}")))
|
|
(form
|
|
("class" "card flex flex-col gap-2")
|
|
("onsubmit" "create_app_from_form(event)")
|
|
(div
|
|
("class" "flex flex-col gap-1")
|
|
(label
|
|
("for" "title")
|
|
(text "{{ text \"communities:label.name\" }}"))
|
|
(input
|
|
("type" "text")
|
|
("name" "title")
|
|
("id" "title")
|
|
("placeholder" "name")
|
|
("required" "")
|
|
("minlength" "2")
|
|
("maxlength" "32")))
|
|
(div
|
|
("class" "flex flex-col gap-1")
|
|
(label
|
|
("for" "title")
|
|
(text "{{ text \"developer:label.homepage\" }}"))
|
|
(input
|
|
("type" "url")
|
|
("name" "homepage")
|
|
("id" "homepage")
|
|
("placeholder" "homepage")
|
|
("required" "")
|
|
("minlength" "2")
|
|
("maxlength" "32")))
|
|
(div
|
|
("class" "flex flex-col gap-1")
|
|
(label
|
|
("for" "title")
|
|
(text "{{ text \"developer:label.redirect\" }}"))
|
|
(input
|
|
("type" "url")
|
|
("name" "redirect")
|
|
("id" "redirect")
|
|
("placeholder" "redirect URL")
|
|
("required" "")
|
|
("minlength" "2")
|
|
("maxlength" "32")))
|
|
(button
|
|
("class" "primary")
|
|
(text "{{ text \"communities:action.create\" }}"))))
|
|
|
|
; app listing
|
|
(div
|
|
("class" "card-nest")
|
|
(div
|
|
("class" "card small flex items-center gap-2")
|
|
(icon (text "bot"))
|
|
(str (text "developer:label.my_apps")))
|
|
|
|
(div
|
|
("class" "card flex flex-col gap-2")
|
|
(text "{% for item in list %}")
|
|
(a
|
|
("href" "/developer/app/{{ item.id }}")
|
|
("class" "card secondary flex flex-col gap-2")
|
|
(div
|
|
("class" "flex items-center gap-2")
|
|
(text "{{ icon \"code\" }}")
|
|
(b
|
|
(text "{{ item.title }}")))
|
|
(span
|
|
(text "Created ")
|
|
(span
|
|
("class" "date")
|
|
(text "{{ item.created }}"))
|
|
(text "; {{ item.quota_status }} mode; {{ item.grants }} users")))
|
|
(text "{% endfor %}")))
|
|
|
|
; useful links
|
|
(div
|
|
("class" "card-nest")
|
|
(div
|
|
("class" "card small flex items-center gap-2")
|
|
(icon (text "circle-help"))
|
|
(str (text "developer:label.guides_and_help")))
|
|
|
|
(div
|
|
("class" "card")
|
|
(ul
|
|
(li
|
|
(a ("href" "https://trisua.com/t/tetratto") (text "Source code")))
|
|
(li
|
|
(a ("href" "https://tetratto.com/reference/tetratto/index.html") ("data-turbo" "false") (text "Source code reference")))
|
|
(li
|
|
(a ("href" "https://tetratto.com/reference/tetratto/model/struct.ApiReturn.html") ("data-turbo" "false") (text "API response structure")))
|
|
(li
|
|
(a ("href" "https://tetratto.com/reference/tetratto/model/oauth/enum.AppScope.html") ("data-turbo" "false") (text "App scopes")))
|
|
(li
|
|
(a ("href" "https://tetratto.com/reference/tetratto/model/permissions/struct.FinePermission.html") ("data-turbo" "false") (text "User permissions")))
|
|
(li
|
|
(a ("href" "https://tetratto.com/reference/tetratto/model/communities_permissions/struct.CommunityPermission.html") ("data-turbo" "false") (text "Community member permissions")))
|
|
(li
|
|
(a ("href" "https://tetratto.com/forge/tetratto") (text "Report issues")))))))
|
|
|
|
(script
|
|
(text "async function create_app_from_form(e) {
|
|
e.preventDefault();
|
|
await trigger(\"atto::debounce\", [\"apps::create\"]);
|
|
|
|
fetch(\"/api/v1/apps\", {
|
|
method: \"POST\",
|
|
headers: {
|
|
\"Content-Type\": \"application/json\",
|
|
},
|
|
body: JSON.stringify({
|
|
title: e.target.title.value,
|
|
homepage: e.target.homepage.value,
|
|
redirect: e.target.redirect.value,
|
|
}),
|
|
})
|
|
.then((res) => res.json())
|
|
.then((res) => {
|
|
trigger(\"atto::toast\", [
|
|
res.ok ? \"success\" : \"error\",
|
|
res.message,
|
|
]);
|
|
|
|
if (res.ok) {
|
|
e.target.reset();
|
|
setTimeout(() => {
|
|
window.location.href = `/developer/app/${res.payload}`;
|
|
}, 100);
|
|
}
|
|
});
|
|
}"))
|
|
(text "{% endblock %}")
|