malachite/app/templates_src/view.lisp
2025-08-20 00:26:44 -04:00

94 lines
3.7 KiB
Common Lisp

(text "{% extends \"root.lisp\" %} {% block head %}")
(text "{% if not metadata.page_title -%}")
(title
(text "{{ entry.slug }}"))
(text "{%- endif %} {{ metadata_head|safe }}")
(text "{% if not metadata.share_title -%}")
(meta ("property" "og:title") ("content" "{{ entry.slug }}"))
(meta ("property" "twitter:title") ("content" "{{ entry.slug }}"))
(text "{%- endif %}")
(text "{% if metadata.page_icon|length == 0 -%}")
(link ("rel" "icon") ("href" "/public/favicon.svg"))
(text "{%- endif %}")
(text "{% endblock %} {% block body %}")
(div
("class" "flex flex_col gap_2")
(div
("class" "card container")
("id" "content_rect")
("style" "min-height: 15rem")
(text "{{ entry.content|markdown|safe }}"))
(div
("class" "w_full flex justify_between gap_2")
(a
("class" "button")
("href" "/{{ entry.slug }}/edit{% if password -%} ?key={{ password }} {%- endif %}")
(text "Edit"))
(div
("class" "flex flex_col gap-1 items-end fade")
; dates
(span (text "Pub: {{ entry.created / 1000|int|date(format=\"%Y-%m-%d %H:%M\", timezone=\"Etc/UTC\") }} UTC"))
(span (text "Edit: {{ entry.edited / 1000|int|date(format=\"%Y-%m-%d %H:%M\", timezone=\"Etc/UTC\") }} UTC"))
; auto theme
(text "{% if metadata.access_recommended_theme != 'None' -%}")
(span ("id" "auto_theme") (text "Auto theme: {{ metadata.access_recommended_theme }}"))
(script ("defer" "true") (text "setTimeout(() => { temporary_set_theme('{{ metadata.access_recommended_theme }}') }, 150);"))
(text "{%- endif %}")
; owner
(text "{% if metadata.tetratto_owner_username|length > 0 -%}")
(span
("class" "flex items_center gap_2")
(text "Owner:")
(a
("class" "flex items_center gap_2")
("href" "{{ tetratto }}/@{{ metadata.tetratto_owner_username }}")
(img
("class" "avatar")
("src" "{{ tetratto }}/api/v1/auth/user/{{ metadata.tetratto_owner_username }}/avatar?selector_type=username"))
(text "{{ metadata.tetratto_owner_username }}")))
(text "{%- endif %}")
; views
(text "{% if not metadata.option_disable_views -%}")
(span (text "Views: {{ entry.views }}"))
(text "{%- endif %}")
; easy-to-read
(text "{% if metadata.access_easy_read|length > 0 -%}")
(a ("class" "button small") ("href" "/{{ metadata.access_easy_read }}") (b (text "E2R")))
(text "{%- endif %}"))))
(div ("style" "display: none") ("id" "metadata_css") (text "{{ metadata_css|safe }}"))
(link ("rel" "stylesheet") ("href" "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css"))
(script ("src" "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"))
(script (text "hljs.highlightAll();"))
(text "{% endblock %}")
(text "{% block nav_extras %}")
(button
("class" "button camo fade no_fill")
("title" "Toggle high-contrast")
("id" "toggle_high_contrast_button")
("onclick" "toggle_metadata_css(event)")
(text "{{ icon \"contrast\" }}"))
(text "{% if \"EntryHighContrast\" in flags -%}")
(script
(text "setTimeout(() => {
toggle_metadata_css({ target: document.getElementById(\"toggle_high_contrast_button\") });
}, 150);"))
(text "{%- endif %}")
(text "{% endblock %}")
(text "{% block dropdown %}")
(hr)
(a
("class" "button")
("href" "/{{ entry.slug }}/claim")
(text "claim"))
(text "{%- endblock %}")