UI
This commit is contained in:
19
assets/views/admin/about.html
Normal file
19
assets/views/admin/about.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block title %}Edit About{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Edit About</h1>
|
||||
|
||||
<form method="post" action="/admin/about">
|
||||
<label>
|
||||
Title
|
||||
<input type="text" name="title" value="{{ page.title }}" required>
|
||||
</label>
|
||||
<label>
|
||||
Content
|
||||
<textarea name="content" rows="16" required>{{ page.content }}</textarea>
|
||||
</label>
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
27
assets/views/admin/base.html
Normal file
27
assets/views/admin/base.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Admin{% endblock title %}</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/daisyui@4/dist/full.min.css" rel="stylesheet" type="text/css">
|
||||
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="/admin/dashboard">Dashboard</a>
|
||||
<a href="/admin/blog/articles">Blog</a>
|
||||
<a href="/admin/about">About</a>
|
||||
<a href="/">View site</a>
|
||||
<form method="post" action="/admin/logout">
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
{% block content %}{% endblock content %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
31
assets/views/admin/blog/edit.html
Normal file
31
assets/views/admin/blog/edit.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block title %}Edit Article{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Edit Article</h1>
|
||||
|
||||
<form method="post" action="/admin/blog/articles/{{ article.id }}">
|
||||
<label>
|
||||
Title
|
||||
<input type="text" name="title" value="{{ article.title }}" required>
|
||||
</label>
|
||||
<label>
|
||||
Excerpt
|
||||
<textarea name="excerpt" rows="4">{% if article.excerpt %}{{ article.excerpt }}{% endif %}</textarea>
|
||||
</label>
|
||||
<label>
|
||||
Content
|
||||
<textarea name="content" rows="18" required>{{ article.content }}</textarea>
|
||||
</label>
|
||||
<label>
|
||||
Featured image id
|
||||
<input type="text" name="featured_image_id" value="{% if article.featured_image_id %}{{ article.featured_image_id }}{% endif %}">
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="published" {% if article.published %}checked{% endif %}>
|
||||
Published
|
||||
</label>
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
36
assets/views/admin/blog/index.html
Normal file
36
assets/views/admin/blog/index.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block title %}Blog Articles{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Blog Articles</h1>
|
||||
<p><a href="/admin/blog/articles/new">New article</a></p>
|
||||
|
||||
{% if articles | length > 0 %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for article in articles %}
|
||||
<tr>
|
||||
<td>{{ article.title }}</td>
|
||||
<td>{% if article.published %}Published{% else %}Draft{% endif %}</td>
|
||||
<td>
|
||||
<a href="/admin/blog/articles/{{ article.id }}/edit">Edit</a>
|
||||
<form method="post" action="/admin/blog/articles/{{ article.id }}/delete">
|
||||
<button type="submit">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No articles yet.</p>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
31
assets/views/admin/blog/new.html
Normal file
31
assets/views/admin/blog/new.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block title %}New Article{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>New Article</h1>
|
||||
|
||||
<form method="post" action="/admin/blog/articles">
|
||||
<label>
|
||||
Title
|
||||
<input type="text" name="title" required>
|
||||
</label>
|
||||
<label>
|
||||
Excerpt
|
||||
<textarea name="excerpt" rows="4"></textarea>
|
||||
</label>
|
||||
<label>
|
||||
Content
|
||||
<textarea name="content" rows="18" required></textarea>
|
||||
</label>
|
||||
<label>
|
||||
Featured image id
|
||||
<input type="text" name="featured_image_id">
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="published">
|
||||
Published
|
||||
</label>
|
||||
<button type="submit">Create</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
13
assets/views/admin/index.html
Normal file
13
assets/views/admin/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block title %}Admin{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Admin</h1>
|
||||
<p>Logged in as {{ admin.email }}</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="/admin/blog/articles">Manage blog articles</a></li>
|
||||
<li><a href="/admin/about">Edit about page</a></li>
|
||||
</ul>
|
||||
{% endblock content %}
|
||||
23
assets/views/admin/login.html
Normal file
23
assets/views/admin/login.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Admin login{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Admin login</h1>
|
||||
|
||||
{% if error %}
|
||||
<p>{{ error }}</p>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="/admin/login">
|
||||
<label>
|
||||
Email
|
||||
<input type="email" name="email" required>
|
||||
</label>
|
||||
<label>
|
||||
Password
|
||||
<input type="password" name="password" required>
|
||||
</label>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
24
assets/views/base.html
Normal file
24
assets/views/base.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Universal Web{% endblock title %}</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/daisyui@4/dist/full.min.css" rel="stylesheet" type="text/css">
|
||||
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
<a href="/about">About</a>
|
||||
<a href="/blog">Blog</a>
|
||||
<a href="/admin/login">Admin</a>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
{% block content %}{% endblock content %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
20
assets/views/blog/index.html
Normal file
20
assets/views/blog/index.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Blog{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Blog</h1>
|
||||
|
||||
{% if articles | length > 0 %}
|
||||
<ul>
|
||||
{% for article in articles %}
|
||||
<li>
|
||||
<a href="/blog/{{ article.slug }}">{{ article.title }}</a>
|
||||
{% if article.excerpt %}<p>{{ article.excerpt }}</p>{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>No published posts yet.</p>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
12
assets/views/blog/show.html
Normal file
12
assets/views/blog/show.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ article.title }}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<article>
|
||||
<h1>{{ article.title }}</h1>
|
||||
<p>Views: {{ article.view_count }}</p>
|
||||
{% if article.excerpt %}<p>{{ article.excerpt }}</p>{% endif %}
|
||||
<div>{{ article.content | linebreaksbr | safe }}</div>
|
||||
</article>
|
||||
{% endblock content %}
|
||||
23
assets/views/home/index.html
Normal file
23
assets/views/home/index.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Home{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Home</h1>
|
||||
|
||||
<section>
|
||||
<h2>Latest posts</h2>
|
||||
{% if articles | length > 0 %}
|
||||
<ul>
|
||||
{% for article in articles %}
|
||||
<li>
|
||||
<a href="/blog/{{ article.slug }}">{{ article.title }}</a>
|
||||
{% if article.excerpt %}<p>{{ article.excerpt }}</p>{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>No published posts yet.</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock content %}
|
||||
10
assets/views/pages/about.html
Normal file
10
assets/views/pages/about.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ page.title }}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<article>
|
||||
<h1>{{ page.title }}</h1>
|
||||
<div>{{ page.content | linebreaksbr | safe }}</div>
|
||||
</article>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user