chore: clean up repo
This commit is contained in:
parent
7d93dffaed
commit
92bc424361
11 changed files with 7 additions and 900 deletions
|
@ -6,112 +6,5 @@
|
|||
(meta ("property" "twitter:title") ("content" "{{ name }}"))
|
||||
(link ("rel" "icon") ("href" "/public/favicon.svg"))
|
||||
(text "{% endblock %} {% block body %}")
|
||||
(div
|
||||
("class" "flex items_center bar")
|
||||
(button
|
||||
("class" "button tab_button")
|
||||
("id" "editor_tab_button")
|
||||
("onclick" "tab_editor()")
|
||||
(text "Edit"))
|
||||
(button
|
||||
("class" "button camo tab_button")
|
||||
("id" "preview_tab_button")
|
||||
("onclick" "tab_preview()")
|
||||
(text "Preview"))
|
||||
(button
|
||||
("class" "button camo tab_button")
|
||||
("id" "metadata_tab_button")
|
||||
("onclick" "tab_metadata()")
|
||||
(text "Metadata")
|
||||
(a
|
||||
("class" "button simple surface")
|
||||
("href" "/docs/metadata")
|
||||
("target" "_blank")
|
||||
("title" "Info")
|
||||
(text "i"))))
|
||||
(div
|
||||
("class" "flex justify_center tab")
|
||||
(div
|
||||
("class" "card tab tabs container w_full")
|
||||
("id" "tabs_group")
|
||||
(div
|
||||
("id" "editor_tab")
|
||||
("class" "tab fadein w_full"))
|
||||
(div
|
||||
("id" "preview_tab")
|
||||
("class" "tab fadein hidden w_full"))
|
||||
(div
|
||||
("id" "metadata_tab")
|
||||
("class" "tab fadein hidden w_full"))))
|
||||
(form
|
||||
("class" "w_full flex justify_between gap_2 flex_collapse_rev")
|
||||
("style" "margin-top: var(--pad-2)")
|
||||
("onsubmit" "create_entry(event)")
|
||||
(button
|
||||
("class" "button")
|
||||
(span ("ui_ident" "text") (text "Go"))
|
||||
(span ("class" "hidden loader no_fill") ("ui_ident" "loader") (text "{{ icon \"loader-circle\" }}")))
|
||||
(div
|
||||
("class" "flex gap_2")
|
||||
(input
|
||||
("class" "w_full")
|
||||
("type" "text")
|
||||
("minlength" "2")
|
||||
("name" "edit_code")
|
||||
("placeholder" "Custom edit code"))
|
||||
(input
|
||||
("class" "w_full")
|
||||
("type" "text")
|
||||
("minlength" "2")
|
||||
("maxlength" "32")
|
||||
("name" "slug")
|
||||
("oninput" "check_exists_input(event)")
|
||||
("placeholder" "Custom url"))))
|
||||
|
||||
; editor
|
||||
(script ("src" "https://unpkg.com/codemirror@5.39.2/lib/codemirror.js"))
|
||||
(script ("src" "https://unpkg.com/codemirror@5.39.2/mode/markdown/markdown.js"))
|
||||
(script ("src" "https://unpkg.com/codemirror@5.39.2/mode/toml/toml.js"))
|
||||
(script ("src" "https://unpkg.com/codemirror@5.39.2/addon/display/placeholder.js"))
|
||||
(link ("rel" "stylesheet") ("href" "https://unpkg.com/codemirror@5.39.2/lib/codemirror.css"))
|
||||
(script ("src" "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"))
|
||||
(link ("rel" "stylesheet") ("href" "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css"))
|
||||
|
||||
(script
|
||||
(text "setTimeout(() => {
|
||||
globalThis.init_editor();
|
||||
globalThis.init_editor(\"metadata_editor\", \"toml\", \"metadata_tab\");
|
||||
}, 150);
|
||||
|
||||
globalThis.create_entry = (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const { load, failed } = submitter_load(e.submitter);
|
||||
load();
|
||||
|
||||
fetch(\"/api/v1/entries\", {
|
||||
method: \"POST\",
|
||||
headers: {
|
||||
\"Content-Type\": \"application/json\",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
content: globalThis.editor.getValue(),
|
||||
slug: e.target.slug.value || undefined,
|
||||
edit_code: e.target.edit_code.value || undefined,
|
||||
metadata: globalThis.metadata_editor.getValue(),
|
||||
}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then((res) => {
|
||||
if (res.ok) {
|
||||
globalThis.ALLOW_LEAVE = true;
|
||||
document.cookie = `Atto-Message=\"Entry created! Your edit code: <code>${res.payload[1]}</code>.\"; path=/`;
|
||||
document.cookie = \"Atto-Message-Good=true; path=/\";
|
||||
window.location.href = `/${res.payload[0]}`;
|
||||
} else {
|
||||
show_message(res.message, false);
|
||||
failed();
|
||||
}
|
||||
})
|
||||
}"))
|
||||
(h1 (text "{{ name }}"))
|
||||
(text "{% endblock %}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue