- Add autoHtmx field / htmx partial support
- Add page_foot tag for scripts - Add htmx to admin area - Move create/permalink import to its own module - Add htmx to tech-blog theme - Move dashboard to admin/dashboard
This commit is contained in:
62
src/MyWebLog/themes/admin/layout-partial.liquid
Normal file
62
src/MyWebLog/themes/admin/layout-partial.liquid
Normal file
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{{ page_title | escape }} « Admin « {{ web_log.name | escape }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-dark bg-dark navbar-expand-md justify-content-start px-2 position-fixed top-0 w-100">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="{{ "" | relative_link }}" hx-boost="false">{{ web_log.name }}</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText"
|
||||
aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarText">
|
||||
{% if logged_on -%}
|
||||
<ul class="navbar-nav">
|
||||
{{ "admin/dashboard" | nav_link: "Dashboard" }}
|
||||
{{ "admin/pages" | nav_link: "Pages" }}
|
||||
{{ "admin/posts" | nav_link: "Posts" }}
|
||||
{{ "admin/categories" | nav_link: "Categories" }}
|
||||
{{ "admin/settings" | nav_link: "Settings" }}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
<ul class="navbar-nav flex-grow-1 justify-content-end">
|
||||
{% if logged_on -%}
|
||||
{{ "admin/user/edit" | nav_link: "Edit User" }}
|
||||
{{ "user/log-off" | nav_link: "Log Off" }}
|
||||
{%- else -%}
|
||||
{{ "user/log-on" | nav_link: "Log On" }}
|
||||
{%- endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="mx-3">
|
||||
{% if messages %}
|
||||
<div class="messages mt-2">
|
||||
{% for msg in messages %}
|
||||
<div role="alert" class="alert alert-{{ msg.level }} alert-dismissible fade show">
|
||||
{{ msg.message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
{% if msg.detail %}
|
||||
<hr>
|
||||
{{ msg.detail.value }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ content }}
|
||||
</main>
|
||||
<footer class="position-fixed bottom-0 w-100">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 text-end"><img src="/img/logo-light.png" alt="myWebLog" width="120" height="34"></div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -8,11 +8,11 @@
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="/themes/admin/admin.css">
|
||||
</head>
|
||||
<body>
|
||||
<body hx-boost="true">
|
||||
<header>
|
||||
<nav class="navbar navbar-dark bg-dark navbar-expand-md justify-content-start px-2 position-fixed top-0 w-100">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="{{ "" | relative_link }}">{{ web_log.name }}</a>
|
||||
<a class="navbar-brand" href="{{ "" | relative_link }}" hx-boost="false">{{ web_log.name }}</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText"
|
||||
aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="collapse navbar-collapse" id="navbarText">
|
||||
{% if logged_on -%}
|
||||
<ul class="navbar-nav">
|
||||
{{ "admin" | nav_link: "Dashboard" }}
|
||||
{{ "admin/dashboard" | nav_link: "Dashboard" }}
|
||||
{{ "admin/pages" | nav_link: "Pages" }}
|
||||
{{ "admin/posts" | nav_link: "Posts" }}
|
||||
{{ "admin/categories" | nav_link: "Categories" }}
|
||||
@@ -66,6 +66,7 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
|
||||
crossorigin="anonymous"></script>
|
||||
{{ htmx_script }}
|
||||
<script>
|
||||
const cssLoaded = [...document.styleSheets].filter(it => it.href.indexOf("bootstrap.min.css") > -1).length > 0
|
||||
if (!cssLoaded) {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<label for="postsPerPage">Posts per Page</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4 col-xl-3 offset-xl-1 pb-3">
|
||||
<div class="col-12 col-md-4 col-xl-3 pb-3">
|
||||
<div class="form-floating">
|
||||
<select name="themePath" id="themePath" class="form-control" required>
|
||||
{% for theme in themes -%}
|
||||
@@ -46,7 +46,7 @@
|
||||
<label for="timeZone">Time Zone</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4 col-xl-4 pb-3">
|
||||
<div class="col-12 col-md-4 pb-3">
|
||||
<div class="form-floating">
|
||||
<select name="defaultPage" id="defaultPage" class="form-control" required>
|
||||
{% for pg in pages -%}
|
||||
@@ -59,6 +59,16 @@
|
||||
<label for="defaultPage">Default Page</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4 col-xl-2">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" name="autoHtmx" id="autoHtmx" class="form-check-input" value="true"
|
||||
{%- if model.auto_htmx %} checked="checked"{% endif %}>
|
||||
<label for="autoHtmx" class="form-check-label">Auto-Load htmx</label>
|
||||
</div>
|
||||
<span class="form-text fst-italic">
|
||||
<a href="https://htmx.org" target="_blank" rel="noopener">What is this?</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row pb-3">
|
||||
<div class="col text-center">
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<div>
|
||||
<small>
|
||||
{% if logged_on -%}
|
||||
<a href="{{ "admin" | relative_link }}">Dashboard</a> ~
|
||||
<a href="{{ "admin/dashboard" | relative_link }}">Dashboard</a> ~
|
||||
<a href="{{ "user/log-off" | relative_link }}">Log Off</a>
|
||||
{% else %}
|
||||
<a href="{{ "user/log-on" | relative_link }}">Log On</a>
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</a>
|
||||
• Powered by <a href="https://github.com/bit-badger/myWebLog/tree/v2">myWebLog</a> •
|
||||
{% if logged_on %}
|
||||
<a href="{{ "admin" | relative_link }}">Dashboard</a>
|
||||
<a href="{{ "admin/dashboard" | relative_link }}">Dashboard</a>
|
||||
{% else %}
|
||||
<a href="{{ "user/log-on" | relative_link }}">Log On</a>
|
||||
{%- endif %}
|
||||
|
||||
14
src/MyWebLog/themes/tech-blog/layout-partial.liquid
Normal file
14
src/MyWebLog/themes/tech-blog/layout-partial.liquid
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
{%- if is_home -%}
|
||||
{{ web_log.name }}{% if web_log.subtitle %} | {{ web_log.subtitle.value }}{% endif %}
|
||||
{%- else -%}
|
||||
{{ page_title | strip_html }}{% if page_title and page_title != "" %} » {% endif %}{{ web_log.name }}
|
||||
{%- endif -%}
|
||||
</title>
|
||||
</head>
|
||||
<body>{{ content }}</body>
|
||||
</html>
|
||||
@@ -14,15 +14,21 @@
|
||||
{% page_head -%}
|
||||
</head>
|
||||
<body>
|
||||
<header class="site-header">
|
||||
<header class="site-header" id="top">
|
||||
<div class="header-logo">
|
||||
<a href="{{ "" | relative_link }}">
|
||||
<a href="{{ "" | relative_link }}" hx-boost="true" hx-target="#content" hx-swap="innerHTML show:#top:top"
|
||||
hx-indicator="#loadOverlay">
|
||||
<img src="{{ "img/bitbadger.png" | theme_asset }}"
|
||||
alt="A cartoon badger looking at a computer screen, with his paw on a mouse"
|
||||
title="Bit Badger Solutions">
|
||||
</a>
|
||||
</div>
|
||||
<div class="header-title"><a href="{{ "" | relative_link }}">The Bit Badger Blog</a></div>
|
||||
<div class="header-title">
|
||||
<a href="{{ "" | relative_link }}" hx-boost="true" hx-target="#content" hx-swap="innerHTML show:#top:top"
|
||||
hx-indicator="#loadOverlay">
|
||||
The Bit Badger Blog
|
||||
</a>
|
||||
</div>
|
||||
<div class="header-spacer"> </div>
|
||||
<div class="header-social">
|
||||
<a href="{{ "feed.xml" | relative_link }}" title="Subscribe to The Bit Badger Blog via RSS">
|
||||
@@ -36,8 +42,12 @@
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
<div class="content-wrapper">
|
||||
<main class="content" role="main">
|
||||
<div class="content-wrapper" hx-boost="true" hx-target="#content" hx-swap="innerHTML show:#top:top"
|
||||
hx-indicator="#loadOverlay">
|
||||
<div class="load-overlay" id="loadOverlay">
|
||||
<h1>Loading…</h1>
|
||||
</div>
|
||||
<main class="content" id="content" role="main">
|
||||
{{ content }}
|
||||
</main>
|
||||
<aside class="blog-sidebar">
|
||||
@@ -77,5 +87,6 @@
|
||||
{%- endif %}
|
||||
</span>
|
||||
</footer>
|
||||
{% page_foot %}
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user