Compare commits

...

3 Commits

Author SHA1 Message Date
Niko Abeler 4bbaf3362e action tiles on main admin page 2024-01-24 22:04:15 +01:00
Niko Abeler c196a72d34 WIP grid buttons 2024-01-23 19:17:04 +01:00
Niko Abeler 94b6628411 fix build 2024-01-17 21:38:41 +01:00
12 changed files with 131 additions and 27 deletions

46
.air.toml Normal file
View File

@ -0,0 +1,46 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
args_bin = ["web"]
bin = "./tmp/main"
cmd = "go build -o ./tmp/main owl-blogs/cmd/owl"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html", "css"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = false
time = false
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
keep_scroll = true

3
.gitignore vendored
View File

@ -26,4 +26,5 @@ users/
*.swp
*.db
*.db
tmp/

View File

@ -1,7 +1,7 @@
##
## Build Container
##
FROM golang:1.20-alpine as build
FROM golang:1.21-alpine as build
RUN apk add --no-cache --update git gcc g++

View File

@ -23,6 +23,7 @@ type SiteConfig struct {
Title string
SubTitle string
HeaderColor string
PrimaryColor string
AuthorName string
Me []MeLinks
Lists []EntryList

2
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/gofiber/fiber/v2 v2.47.0
github.com/google/uuid v1.3.0
github.com/jmoiron/sqlx v1.3.5
github.com/mattn/go-sqlite3 v1.14.17
github.com/mattn/go-sqlite3 v1.14.19
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
github.com/yuin/goldmark v1.5.4

2
go.sum
View File

@ -56,6 +56,8 @@ github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI=
github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw=

View File

@ -8,11 +8,31 @@
<meta property="og:title" content="{{template "title" .Data}}" />
<link rel="webmention" href="/webmention/" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/index.xml">
<link rel='stylesheet' href='/static/pico.min.css'>
<link rel='stylesheet' href='/static/style.css'>
<style>
:root {
--primary: {{.SiteConfig.PrimaryColor}};
--primary-hover: color-mix(in srgb,var(--primary),#000 20%);
--primary-focus: color-mix(in srgb,var(--primary),#fff 40%);
--primary-inverse: #FFF;
--background: {{.SiteConfig.HeaderColor}};
--background-dark: color-mix(in srgb,var(--background),#000 50%);
--background-light: color-mix(in srgb,var(--background),#fff 50%);
}
[data-theme="light"],
:root:not([data-theme="dark"]) {
--primary: {{.SiteConfig.PrimaryColor}};
--primary-hover: color-mix(in srgb,var(--primary),#000 20%);
--primary-focus: color-mix(in srgb,var(--primary),#fff 40%);
--primary-inverse: #FFF;
}
header {
background-color: {{.SiteConfig.HeaderColor}};
background-color: var(--background);
padding-bottom: 1rem !important;
}

View File

@ -1,31 +1,40 @@
{{define "title"}}Admin{{end}}
{{define "main"}}
<h2>Write</h2>
<h2 style="margin-bottom: 1rem;">Write</h2>
<ul>
<div class="action-tile-list">
{{range .Types}}
<li><a href="/editor/new/{{.}}/">{{.}}</a></li>
<a class="action-tile" href="/editor/new/{{.}}/">{{.}}</a>
{{end}}
</ul>
</div>
<br>
<br>
<h2>Content</h2>
<ul>
<li><a href="/admin/binaries/">Files</a></li>
<li><a href="/admin/drafts/">Drafts</a></li>
</ul>
<h2 style="margin-bottom: 1rem;">Content</h2>
<div class="action-tile-list">
<a class="action-tile" href="/admin/binaries/">Files</a>
<a class="action-tile" href="/admin/drafts/">Drafts</a>
</div>
<br>
<br>
<h2>Configurations</h2>
<ul>
<li><a href="/site-config">Site Settings</a></li>
<li><a href="/site-config/me">Me Links</a></li>
<li><a href="/site-config/lists">Lists</a></li>
<li><a href="/site-config/menus">Menus</a></li>
<li>Modules</li>
<ul>
{{ range .Configs }}
<li><a href="/admin/config/{{.Name}}">{{.Name}}</a></li>
{{ end }}
</ul>
</ul>
<h2 style="margin-bottom: 1rem;">Configurations</h2>
<div class="action-tile-list">
<a class="action-tile" href="/site-config">Site Settings</a>
<a class="action-tile" href="/site-config/me">Me Links</a>
<a class="action-tile" href="/site-config/lists">Lists</a>
<a class="action-tile" href="/site-config/menus">Menus</a>
</div>
<br>
<br>
<h3>Module Configuration</h3>
<div class="action-tile-list">
{{ range .Configs }}
<a class="action-tile" href="/admin/config/{{.Name}}">{{.Name}}</a>
{{ end }}
</div>
<br>
<br>
{{end}}

View File

@ -16,6 +16,9 @@
<label for="HeaderColor">HeaderColor</label>
<input type="color" name="HeaderColor" id="HeaderColor" value="{{.HeaderColor}}"/>
<label for="PrimaryColor">PrimaryColor</label>
<input type="color" name="PrimaryColor" id="PrimaryColor" value="{{.PrimaryColor}}"/>
<label for="AuthorName">AuthorName</label>
<input type="text" name="AuthorName" id="AuthorName" value="{{.AuthorName}}"/>

1
tmp/build-errors.log Normal file
View File

@ -0,0 +1 @@
exit status 1

View File

@ -44,6 +44,7 @@ func (h *SiteConfigHandler) HandlePost(c *fiber.Ctx) error {
siteConfig.Title = c.FormValue("Title")
siteConfig.SubTitle = c.FormValue("SubTitle")
siteConfig.HeaderColor = c.FormValue("HeaderColor")
siteConfig.PrimaryColor = c.FormValue("PrimaryColor")
siteConfig.AuthorName = c.FormValue("AuthorName")
siteConfig.AvatarUrl = c.FormValue("AvatarUrl")
siteConfig.FullUrl = c.FormValue("FullUrl")

20
web/static/style.css Normal file
View File

@ -0,0 +1,20 @@
.action-tile-list {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.action-tile {
border: 1px solid var(--background-dark);
padding: 20px;
flex: 1 1 0px;
margin: 6px;
min-width: 20%;
text-align: center;
background: var(--background);
border-radius: 4px;
}
.action-tile:hover {
background: var(--background-light);
}