Add feature: system nav editor in config

This commit is contained in:
Anya Tokugawa committed 2026-05-31 22:44:40 +09:00
1 parent e3a28c9f62
commit e8e9b505af
17 files changed
+409 -156

No files matched your search

+125 -50
View File
@@ -3,7 +3,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Config</title>
<title>{{ T "config.title" }}</title>
<link rel="stylesheet" href="/o/path:/system/static/css/main.css">
<link rel="stylesheet" href="/o/path:/system/static/css/modes.css">
</head>
@@ -18,7 +18,7 @@
<nav>
{{ range .NavItems }}
<a href="{{ .Href }}">{{ .Label }}</a>
<a href="{{ .ResolvedHref }}">{{ .Label }}</a>
{{ end }}
</nav>
@@ -42,15 +42,19 @@
<nav class="sidebar-nav">
<a href="#" data-panel="home" onclick="showConfigPanel('home'); return false;">
Home
{{ T "config.home" }}
</a>
<a href="#" data-panel="objects" onclick="showConfigPanel('objects'); return false;">
Recent Objects
{{ T "config.objects" }}
</a>
<a href="#" data-panel="nav" onclick="showConfigPanel('nav'); return false;">
Navigation
<a href="#" data-panel="nav-home" onclick="showConfigPanel('nav-home'); return false;">
Home Navigation
</a>
<a href="#" data-panel="nav-system" onclick="showConfigPanel('nav-system'); return false;">
System Navigation
</a>
</nav>
@@ -64,9 +68,9 @@ Navigation
class="config-section config-panel active"
>
<h1>Config</h1>
<h1>{{ T "config.title" }}</h1>
<h2>Home</h2>
<h2>{{ T "config.home" }}</h2>
<form
method="post"
@@ -121,13 +125,9 @@ English
name="home_path"
type="text"
value="{{ .HomePath }}"
placeholder="/pageswiki/home"
placeholder="/home"
>
<p class="muted">
If empty, the top page shows child pages like an Apache-style index.
</p>
<br>
<button type="submit">
Save
</button>
@@ -190,12 +190,13 @@ Save
</section>
<section
id="panel-nav"
id="panel-nav-home"
class="config-section config-panel"
>
<h2>{{ T "config.nav" }}</h2>
<h2>Home Navigation</h2>
<form
method="post"
@@ -205,7 +206,7 @@ Save
<input
type="hidden"
name="section"
value="nav"
value="nav-home"
>
<table class="recent-table">
@@ -220,8 +221,7 @@ Save
<tbody>
{{ range .NavItemsConfig }}
{{ range .HomeNavItemsConfig }}
<tr>
<td>
@@ -241,21 +241,9 @@ Save
</td>
<td>
<button
type="button"
onclick="moveNavRow(this, -1)"
>
↑
</button>
<button
type="button"
onclick="moveNavRow(this, 1)"
>
↓
</button>
<button type="button" onclick="moveNavRow(this, -1)">↑</button>
<button type="button" onclick="moveNavRow(this, 1)">↓</button>
</td>
</tr>
{{ end }}
@@ -278,36 +266,116 @@ Save
</td>
<td>
<button
type="button"
onclick="moveNavRow(this, -1)"
>
↑
</button>
<button
type="button"
onclick="moveNavRow(this, 1)"
>
↓
</button>
<button type="button" onclick="moveNavRow(this, -1)">↑</button>
<button type="button" onclick="moveNavRow(this, 1)">↓</button>
</td>
</tr>
</tbody>
</table>
<button type="submit">
Save Navigation
{{ T "config.nav_save" }}
</button>
</form>
</section>
<section
id="panel-nav-system"
class="config-section config-panel"
>
<h2>System Navigation</h2>
<form
method="post"
action="/-/sys/config"
>
<input
type="hidden"
name="section"
value="nav-system"
>
<table class="recent-table">
<thead>
<tr>
<th>{{ T "config.nav_label" }}</th>
<th>{{ T "config.nav_href" }}</th>
<th>{{ T "config.nav_order" }}</th>
</tr>
</thead>
<tbody>
{{ range .SystemNavItemsConfig }}
<tr>
<td>
<input
name="nav_label"
type="text"
value="{{ .Label }}"
>
</td>
<td>
<input
name="nav_href"
type="text"
value="{{ .Href }}"
>
</td>
<td>
<button type="button" onclick="moveNavRow(this, -1)">↑</button>
<button type="button" onclick="moveNavRow(this, 1)">↓</button>
</td>
</tr>
{{ end }}
<tr>
<td>
<input
name="nav_label"
type="text"
placeholder="Label"
>
</td>
<td>
<input
name="nav_href"
type="text"
placeholder="/path"
>
</td>
<td>
<button type="button" onclick="moveNavRow(this, -1)">↑</button>
<button type="button" onclick="moveNavRow(this, 1)">↓</button>
</td>
</tr>
</tbody>
</table>
<button type="submit">
{{ T "config.nav_save" }}
</button>
</form>
</section>
</section>
</main>
@@ -380,8 +448,15 @@ document.addEventListener(
location.search
)
showConfigPanel(
let panel =
params.get("panel") || "home"
if (panel === "nav") {
panel = "nav-home"
}
showConfigPanel(
panel
)
},
)
+1 -1
View File
@@ -18,7 +18,7 @@
<nav>
{{ range .NavItems }}
<a href="{{ .Href }}">{{ .Label }}</a>
<a href="{{ .ResolvedHref }}">{{ .Label }}</a>
{{ end }}
</nav>
+1 -1
View File
@@ -18,7 +18,7 @@
<nav>
{{ range .NavItems }}
<a href="{{ .Href }}">{{ .Label }}</a>
<a href="{{ .ResolvedHref }}">{{ .Label }}</a>
{{ end }}
</nav>
+1 -1
View File
@@ -18,7 +18,7 @@
<nav>
{{ range .NavItems }}
<a href="{{ .Href }}">{{ .Label }}</a>
<a href="{{ .ResolvedHref }}">{{ .Label }}</a>
{{ end }}
</nav>
+1 -1
View File
@@ -31,7 +31,7 @@
<nav>
{{ range .NavItems }}
<a href="{{ .Href }}">{{ .Label }}</a>
<a href="{{ .ResolvedHref }}">{{ .Label }}</a>
{{ end }}
</nav>
+1 -1
View File
@@ -558,7 +558,7 @@ Pages Wiki
<nav>
{{ range .NavItems }}
<a href="{{ .Href }}">{{ .Label }}</a>
<a href="{{ .ResolvedHref }}">{{ .Label }}</a>
{{ end }}
</nav>