add configuration: top nav order and settings
This commit is contained in:
1 parent
d300354725
commit
12decb7862
9 files changed
+386
-71
No files matched your search
@@ -15,10 +15,13 @@
|
||||
<a href="/">Pages Wiki</a>
|
||||
</div>
|
||||
|
||||
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
<a href="/v/tree">Tree</a>
|
||||
{{ range .NavItems }}
|
||||
<a href="{{ .Href }}">{{ .Label }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<main class="config-layout">
|
||||
@@ -46,6 +49,10 @@ Home
|
||||
Recent Objects
|
||||
</a>
|
||||
|
||||
<a href="#" data-panel="nav" onclick="showConfigPanel('nav'); return false;">
|
||||
Navigation
|
||||
</a>
|
||||
|
||||
</nav>
|
||||
|
||||
</aside>
|
||||
@@ -66,6 +73,12 @@ Recent Objects
|
||||
action="/-/sys/config"
|
||||
>
|
||||
|
||||
<input
|
||||
type="hidden"
|
||||
name="section"
|
||||
value="home"
|
||||
>
|
||||
|
||||
<label>
|
||||
Home semantic path
|
||||
</label>
|
||||
@@ -143,6 +156,124 @@ Save
|
||||
|
||||
</section>
|
||||
|
||||
<section
|
||||
id="panel-nav"
|
||||
class="config-section config-panel"
|
||||
>
|
||||
|
||||
<h2>Navigation</h2>
|
||||
|
||||
<form
|
||||
method="post"
|
||||
action="/-/sys/config"
|
||||
>
|
||||
|
||||
<input
|
||||
type="hidden"
|
||||
name="section"
|
||||
value="nav"
|
||||
>
|
||||
|
||||
<table class="recent-table">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Label</th>
|
||||
<th>Href</th>
|
||||
<th>Order</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
{{ range .NavItemsConfig }}
|
||||
|
||||
<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">
|
||||
Save Navigation
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</main>
|
||||
@@ -220,6 +351,45 @@ document.addEventListener(
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
function moveNavRow(button, direction) {
|
||||
|
||||
const row =
|
||||
button.closest(
|
||||
"tr"
|
||||
)
|
||||
|
||||
const tbody =
|
||||
row.parentElement
|
||||
|
||||
if (direction < 0) {
|
||||
|
||||
const prev =
|
||||
row.previousElementSibling
|
||||
|
||||
if (prev) {
|
||||
|
||||
tbody.insertBefore(
|
||||
row,
|
||||
prev
|
||||
)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
const next =
|
||||
row.nextElementSibling
|
||||
|
||||
if (next) {
|
||||
|
||||
tbody.insertBefore(
|
||||
next,
|
||||
row
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
<a href="/">Pages Wiki</a>
|
||||
</div>
|
||||
|
||||
|
||||
<nav>
|
||||
<a href="/v/tree">Tree</a>
|
||||
<a href="/-/sys/config">Config</a>
|
||||
<a href="/new">Draft</a>
|
||||
{{ range .NavItems }}
|
||||
<a href="{{ .Href }}">{{ .Label }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
<a href="/">Pages Wiki</a>
|
||||
</div>
|
||||
|
||||
|
||||
<nav>
|
||||
<a href="/o/{{ .ObjectURI }}">View</a>
|
||||
<a href="/o/r/{{ .ObjectURI }}">History</a>
|
||||
<a href="/l?object_uuid={{ .ObjectUUID }}">Link</a>
|
||||
{{ range .NavItems }}
|
||||
<a href="{{ .Href }}">{{ .Label }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
<a href="/">Pages Wiki</a>
|
||||
</div>
|
||||
|
||||
|
||||
<nav>
|
||||
<a href="/o/e/{{ .ObjectURI }}">Edit</a>
|
||||
<a href="/o/r/{{ .ObjectURI }}">History</a>
|
||||
<a href="/l?object_uuid={{ .ObjectUUID }}">Link</a>
|
||||
<a href="#" onclick="deleteObject('{{ .ObjectUUID }}'); return false;">Delete</a>
|
||||
{{ range .NavItems }}
|
||||
<a href="{{ .Href }}">{{ .Label }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
|
||||
@@ -28,32 +28,14 @@
|
||||
<a href="/">Pages Wiki</a>
|
||||
</div>
|
||||
|
||||
|
||||
<nav>
|
||||
|
||||
<a href="/">Home</a>
|
||||
|
||||
{{ if .Path }}
|
||||
|
||||
<a href="/e{{ .Path }}">
|
||||
Edit
|
||||
</a>
|
||||
|
||||
<a href="/r/history/{{ .ObjectUUID }}">
|
||||
History
|
||||
</a>
|
||||
|
||||
<a href="/l?object_uuid={{ .ObjectUUID }}">
|
||||
Links
|
||||
</a>
|
||||
|
||||
<a href="/raw{{ .Path }}">
|
||||
Raw
|
||||
</a>
|
||||
|
||||
{{ range .NavItems }}
|
||||
<a href="{{ .Href }}">{{ .Label }}</a>
|
||||
{{ end }}
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
|
||||
@@ -555,14 +555,14 @@ body {
|
||||
Pages Wiki
|
||||
</div>
|
||||
|
||||
|
||||
<nav>
|
||||
|
||||
<a href="/">
|
||||
Home
|
||||
</a>
|
||||
|
||||
{{ range .NavItems }}
|
||||
<a href="{{ .Href }}">{{ .Label }}</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
|
||||
Reference in new issue
Block a user