action tiles on main admin page

This commit is contained in:
Niko Abeler 2024-01-24 22:04:15 +01:00
parent c196a72d34
commit 4bbaf3362e
9 changed files with 108 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

1
.gitignore vendored
View File

@ -27,3 +27,4 @@ users/
*.db *.db
tmp/

View File

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

View File

@ -13,11 +13,26 @@
<link rel='stylesheet' href='/static/style.css'> <link rel='stylesheet' href='/static/style.css'>
<style> <style>
:root { :root {
--color-primary: {{.SiteConfig.HeaderColor}}; --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 { header {
background-color: var(--color-primary); background-color: var(--background);
padding-bottom: 1rem !important; padding-bottom: 1rem !important;
} }

View File

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

View File

@ -16,6 +16,9 @@
<label for="HeaderColor">HeaderColor</label> <label for="HeaderColor">HeaderColor</label>
<input type="color" name="HeaderColor" id="HeaderColor" value="{{.HeaderColor}}"/> <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> <label for="AuthorName">AuthorName</label>
<input type="text" name="AuthorName" id="AuthorName" value="{{.AuthorName}}"/> <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.Title = c.FormValue("Title")
siteConfig.SubTitle = c.FormValue("SubTitle") siteConfig.SubTitle = c.FormValue("SubTitle")
siteConfig.HeaderColor = c.FormValue("HeaderColor") siteConfig.HeaderColor = c.FormValue("HeaderColor")
siteConfig.PrimaryColor = c.FormValue("PrimaryColor")
siteConfig.AuthorName = c.FormValue("AuthorName") siteConfig.AuthorName = c.FormValue("AuthorName")
siteConfig.AvatarUrl = c.FormValue("AvatarUrl") siteConfig.AvatarUrl = c.FormValue("AvatarUrl")
siteConfig.FullUrl = c.FormValue("FullUrl") siteConfig.FullUrl = c.FormValue("FullUrl")

View File

@ -5,12 +5,16 @@
} }
.action-tile { .action-tile {
border: 1px solid var(--color-primary); border: 1px solid var(--background-dark);
padding: 20px; padding: 20px;
flex: 1 1 0px; flex: 1 1 0px;
margin: 6px; margin: 6px;
min-width: 20%; min-width: 20%;
text-align: center; text-align: center;
background: var(--color-primary); background: var(--background);
border-radius: 4px; border-radius: 4px;
} }
.action-tile:hover {
background: var(--background-light);
}