laterite-admin 0.9.12

Laterite CMF admin surface: the Axum router, session middleware, and login shell
Documentation
<!DOCTYPE html>
<html lang="{{ shell.locale() }}" data-theme="light">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{% block title %}{{ shell.brand }}{% endblock %}</title>
  <link rel="icon" type="image/svg+xml" href="{{ shell.asset("mark.svg") }}">
  <link rel="stylesheet" href="{{ shell.asset("laterite.css") }}">
  {% include "_theme_boot.html" %}
  <script defer src="{{ shell.asset("vendor/htmx.min.js") }}"></script>
  <script defer src="{{ shell.asset("laterite.js") }}"></script>
  {% for a in shell.assets %}{% if a.css %}<link rel="stylesheet" href="{{ a.url }}" data-lat-asset="{{ a.url }}">{% else %}<script defer src="{{ a.url }}" data-lat-asset="{{ a.url }}"></script>{% endif %}
  {% endfor %}
</head>
<body class="lat-app" hx-headers='{"X-CSRF-Token": "{{ shell.csrf_token }}"}' data-lat-request-error='{{ shell.t("Something went wrong. Please try again.") }}' data-lat-cancel='{{ shell.t("Cancel") }}' data-lat-leave='{{ shell.t("You have unsaved changes. Leave without saving?") }}' data-lat-leave-go='{{ shell.t("Leave") }}' data-lat-leave-stay='{{ shell.t("Stay") }}'>
  {% if !shell.flash.is_empty() %}
  <div class="lat-flashes" role="status" aria-live="polite">
    {% for f in shell.flash %}
    <div class="lat-flash {{ f.level.class() }}" data-lat-widget="flash"{% if f.sticky %} data-lat-persist{% endif %}>
      <span class="lat-flash__text">{{ f.text }}</span>
      <button type="button" class="lat-flash__close" aria-label='{{ shell.t("Dismiss") }}' onclick="latDismissFlash(this)">&times;</button>
    </div>
    {% endfor %}
  </div>
  {% endif %}
  <header class="lat-topnav">
    <button class="lat-topnav__burger" type="button" onclick="latToggleMenu()" aria-label='{{ shell.t("Menu") }}'>&#9776;</button>
    <a class="lat-topnav__brand" href="{{ shell.base }}">
      <img src="{{ shell.asset("mark.png") }}" alt="">
      <span class="lat-topnav__wordmark">{{ shell.brand }}</span>
    </a>
    <nav class="lat-topnav__nav" data-lat-widget="menu-order" data-menu-post="{{ shell.base }}/preferences/menu" data-menu-csrf="{{ shell.csrf_token }}">
      {% for item in shell.nav %}<a class="lat-topnav__section{% if item.active %} is-active{% endif %}" href="{{ item.path }}" data-lat-key="{{ item.key }}"{% if item.key != "dashboard" && item.key != "settings" %} draggable="true"{% endif %}{% if item.active %} aria-current="page"{% endif %}>{% if !item.icon.is_empty() %}<span class="lat-topnav__ico">{{ item.icon|safe }}</span>{% endif %}<span>{{ item.label }}</span></a>{% endfor %}
    </nav>
    <div class="lat-topnav__spacer"></div>
    <div class="lat-topnav__right">
      {# A way out to the front of the site being administered. Opens in a new
         tab, so the operator does not lose the screen they were working on. #}
      <a class="lat-topnav__out" href="{{ shell.site_url() }}" target="_blank" rel="noopener noreferrer"
         title='{{ shell.t("View the site") }}' aria-label='{{ shell.t("View the site") }}'>{{ shell.icon("external-link")|safe }}</a>
      <a class="lat-topnav__out lat-palette__open" href="{{ shell.base }}/palette" data-lat-widget="palette" data-palette-url="{{ shell.base }}/palette" data-palette-placeholder='{{ shell.t("Go to a page, a setting or a record") }}' data-palette-empty='{{ shell.t("Nothing matches.") }}'
         title='{{ shell.t("Go to (Ctrl+K)") }}' aria-label='{{ shell.t("Go to") }}'>{{ shell.icon("search")|safe }}</a>
      <button class="lat-modebtn" type="button" onclick="latCycleMode()" title='{{ shell.t("Colour mode") }}' aria-label='{{ shell.t("Colour mode") }}'><span id="lat-mode-ico">◐</span></button>
      <details class="lat-usermenu">
        <summary class="lat-avatar" title="{{ shell.full_name }}">{{ shell.initial }}</summary>
        <div class="lat-usermenu__panel">
          <div class="lat-usermenu__name">{{ shell.full_name }}</div>
          <a class="lat-usermenu__item" href="{{ shell.base }}/preferences">{{ shell.t("Preferences") }}</a>
          <form method="post" action="{{ shell.base }}/logout">{% include "_csrf.html" %}<button class="lat-usermenu__item" type="submit">{{ shell.t("Sign out") }}</button></form>
          <a class="lat-usermenu__poweredby" href="https://laterite.rs" target="_blank" rel="noopener noreferrer"><img src="{{ shell.asset("mark.png") }}" alt="" width="14" height="14">{{ shell.t("Powered by Laterite") }}</a>
        </div>
      </details>
    </div>
  </header>
  <div class="lat-drawer" id="lat-menu">
    <div class="lat-drawer__backdrop" onclick="latToggleMenu()"></div>
    <nav class="lat-drawer__panel">
      <div class="lat-drawer__brand"><img src="{{ shell.asset("mark.png") }}" alt=""><span>{{ shell.brand }}</span></div>
      {% for item in shell.nav %}<a class="lat-drawer__item{% if item.active %} is-active{% endif %}" href="{{ item.path }}"{% if item.active %} aria-current="page"{% endif %}>{{ item.label }}</a>
      {% if item.active %}{% include "_drawer_section.html" %}{% endif %}{% endfor %}
      {% if !shell.sidebar_anchored() %}{% include "_drawer_section.html" %}{% endif %}
    </nav>
  </div>
  <div class="lat-body">
    {% if !shell.sidebar.is_empty() %}
    <aside class="lat-sidebar">
      {% for group in shell.sidebar %}
      <details class="lat-sidebar__group" open>
        <summary class="lat-sidebar__grouphead"><span>{{ group.name }}</span><span class="lat-sidebar__chevron"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg></span></summary>
        {% for item in group.items %}
        <a class="lat-sidebar__item{% if item.active %} is-active{% endif %}" href="{{ item.path }}">
          <span class="lat-sidebar__icon">{{ item.icon|safe }}</span>
          <span class="lat-sidebar__text">
            <span class="lat-sidebar__title">{{ item.label }}</span>
            {% if !item.description.is_empty() %}<span class="lat-sidebar__desc">{{ item.description }}</span>{% endif %}
          </span>
        </a>
        {% endfor %}
      </details>
      {% endfor %}
    </aside>
    {% endif %}
    <main class="lat-main">
      <div class="lat-page">
        {% if shell.crumbs.len() > 1 %}
        <nav class="lat-breadcrumb" aria-label='{{ shell.t("You are here") }}'>{% for c in shell.crumbs %}{% if !loop.first %}<span aria-hidden="true">&rsaquo;</span>{% endif %}<a href="{{ c.href }}">{{ c.label }}</a>{% endfor %}</nav>
        {% endif %}
        {% block content %}{% endblock %}
      </div>
    </main>
  </div>
</body>
</html>