From f45bdcd83c31140392cf89cc76412df4f294ddbf Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sat, 21 Mar 2026 12:01:24 +1100 Subject: [PATCH] Styled the admin section of categories. --- assets/css/main.scss | 59 ++++++++++++++++++++++++-------- handlers/posts.go | 2 ++ providers/sitebuilder/builder.go | 9 ++--- views/categories/edit.html | 10 +++--- views/categories/index.html | 39 +++++++++------------ views/layouts/main.html | 2 +- views/posts/edit.html | 6 ++-- views/posts/index.html | 7 ++-- 8 files changed, 78 insertions(+), 56 deletions(-) diff --git a/assets/css/main.scss b/assets/css/main.scss index c8f0344..dc6ad7d 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -10,21 +10,7 @@ $container-max-widths: ( @import "bootstrap/scss/bootstrap.scss"; -// Local classes - -.post-form { - display: grid; - grid-template-rows: min-content auto min-content; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; -} - -.post-form textarea { - height: 100%; -} +// Post list .postlist .post img { max-width: 300px; @@ -32,6 +18,49 @@ $container-max-widths: ( max-height: 300px; } +.postlist .post-date { + font-size: 0.9rem; +} + +// Post form + +// Post edit page styling +.post-edit-page { + height: 100vh; +} + +.post-edit-page main { + display: flex; + flex-direction: column; + overflow: hidden; +} + +.post-edit-page .post-form { + flex: 1; + display: flex; + flex-direction: column; + min-height: 0; +} + +.post-edit-page .post-form .row { + flex: 1; + display: flex; + min-height: 0; +} + +.post-edit-page .post-form .col-md-9 { + display: flex; + flex-direction: column; +} + +.post-edit-page .post-form textarea { + flex: 1; + resize: vertical; + min-height: 300px; +} + + + .show-upload figure img { max-width: 100vw; height: auto; diff --git a/handlers/posts.go b/handlers/posts.go index a339685..a133758 100644 --- a/handlers/posts.go +++ b/handlers/posts.go @@ -53,6 +53,7 @@ func (ph PostsHandler) New(c fiber.Ctx) error { "post": p, "categories": cats, "selectedCategories": map[int64]bool{}, + "bodyClass": "post-edit-page", }) } @@ -93,6 +94,7 @@ func (ph PostsHandler) Edit(c fiber.Ctx) error { "post": post, "categories": cats, "selectedCategories": selectedCategories, + "bodyClass": "post-edit-page", }) })) } diff --git a/providers/sitebuilder/builder.go b/providers/sitebuilder/builder.go index 5775149..346f77c 100644 --- a/providers/sitebuilder/builder.go +++ b/providers/sitebuilder/builder.go @@ -176,10 +176,11 @@ func (b *Builder) renderFeeds(ctx buildContext, postIter iter.Seq[models.Maybe[* } feed.Items = append(feed.Items, &feedhub.Item{ - Id: filepath.Join(b.site.BaseURL, post.GUID), - Title: postTitle, - Link: &feedhub.Link{Href: renderedPost.PostURL}, - Content: string(renderedPost.HTML), + Id: filepath.Join(b.site.BaseURL, post.GUID), + Title: postTitle, + Link: &feedhub.Link{Href: renderedPost.PostURL}, + Content: string(renderedPost.HTML), + // TO FIX: Why the heck does this only include the first category? Category: catName, // TO FIX: Created should be first published Created: post.PublishedAt, diff --git a/views/categories/edit.html b/views/categories/edit.html index c838778..c6c3606 100644 --- a/views/categories/edit.html +++ b/views/categories/edit.html @@ -1,6 +1,6 @@
-

{{ if .isNew }}New Category{{ else }}Edit Category{{ end }}

+
{{ if .isNew }}New Category{{ else }}Edit Category{{ end }}
{{ if .isNew }} @@ -10,27 +10,27 @@ {{ end }}
- +
- +
Auto-generated from name if left blank.
- +
Markdown supported. Displayed on the category archive page.
-
+
{{ if not .isNew }} diff --git a/views/categories/index.html b/views/categories/index.html index f768977..026d919 100644 --- a/views/categories/index.html +++ b/views/categories/index.html @@ -1,35 +1,30 @@
-

Categories

- - - - - - - - - - - {{ range .categories }} + {{ range .categories }} +
NameSlugPosts
+ + + + + + + + - - {{ else }} - - - - {{ end }} - -
NameSlugPosts
{{ .Name }} {{ .Slug }} {{ .PostCount }} - Edit -
No categories yet.
+ + + {{ else }} +
+
📚
No categories yet.
+
+ {{ end }}
diff --git a/views/layouts/main.html b/views/layouts/main.html index 2b81177..908094f 100644 --- a/views/layouts/main.html +++ b/views/layouts/main.html @@ -7,7 +7,7 @@ - + {{ template "_common/nav" . }} {{ embed }} diff --git a/views/posts/edit.html b/views/posts/edit.html index 07be770..d162788 100644 --- a/views/posts/edit.html +++ b/views/posts/edit.html @@ -1,6 +1,6 @@ {{ $isPublished := ne .post.State 1 }}
-
@@ -10,9 +10,7 @@
-
- -
+
{{ if $isPublished }} diff --git a/views/posts/index.html b/views/posts/index.html index 3d2597f..bbf445d 100644 --- a/views/posts/index.html +++ b/views/posts/index.html @@ -28,12 +28,9 @@
{{ if eq $p.State 1 }} - {{ $.user.FormatTime $p.UpdatedAt }} Draft + Draft {{ else }} - {{ $.user.FormatTime $p.PublishedAt }} - {{ end }} - {{ range $p.Categories }} - {{ .Name }} + {{ end }}