Merge branch 'mai/kahn/phase-5j-views-redesign' (phase 5j slice A: paliad-shape schema redesign)

This commit is contained in:
mAi
2026-05-29 11:41:34 +02:00
11 changed files with 1086 additions and 1045 deletions

View File

@@ -1,12 +1,5 @@
{{define "tree-section"}}
<section id="tree-section" class="tree-section">
{{if .DefaultBanner}}
<p class="default-banner muted">
Showing default view: <strong>{{.DefaultBanner.Name}}</strong> ·
<a href="/?nodefault=1"
hx-get="/?nodefault=1" hx-target="#tree-section" hx-swap="outerHTML" hx-push-url="true">clear</a>
</p>
{{end}}
<p class="counts">
<strong>{{.Matched}}</strong> / <strong>{{.Total}}</strong> items match
{{if .OrphanN}} · <strong>{{.OrphanN}}</strong> unclassified mai-managed roots <a href="/admin/classify">→ classify</a>{{end}}

View File

@@ -1,42 +0,0 @@
{{define "content"}}
<h1>Edit view</h1>
<p class="muted"><a href="/views">← back to views</a></p>
<section class="views-create">
<form method="post" action="/views/{{.View.ID}}">
<label>Name <input type="text" name="name" required maxlength="80" value="{{.View.Name}}"></label>
<label>Description <input type="text" name="description" maxlength="200" value="{{.View.Description}}"></label>
<label>View type
<select name="view_type" required>
{{$cur := .View.ViewType}}
{{range .AllViewTypes}}<option value="{{.}}"{{if eq . $cur}} selected{{end}}>{{.}}</option>{{end}}
</select>
</label>
<label>Default for
<select name="is_default_for">
{{$d := deref .View.IsDefaultFor}}
{{range .DefaultForOptions}}<option value="{{.}}"{{if eq . $d}} selected{{end}}>{{if eq . ""}}—{{else}}{{.}}{{end}}</option>{{end}}
</select>
</label>
<label>Group by
<select name="group_by">
{{$g := deref .View.GroupBy}}
{{range .GroupByOptions}}<option value="{{.}}"{{if eq . $g}} selected{{end}}>{{if eq . ""}}—{{else}}{{.}}{{end}}</option>{{end}}
</select>
</label>
<label>Sort field <input type="text" name="sort_field" placeholder="title / updated_at / start_time" maxlength="40" value="{{deref .View.SortField}}"></label>
<label>Sort dir
<select name="sort_dir">
{{$sd := deref .View.SortDir}}
{{range .SortDirOptions}}<option value="{{.}}"{{if eq . $sd}} selected{{end}}>{{if eq . ""}}—{{else}}{{.}}{{end}}</option>{{end}}
</select>
</label>
<label><input type="checkbox" name="pinned" value="1"{{if .View.Pinned}} checked{{end}}> Pinned</label>
<label>Filter (URL query form)
<input type="text" name="filter_query" placeholder="tag=work&mgmt=mai" value="{{.FilterQuery}}">
</label>
<button type="submit">Save changes</button>
<a class="muted" href="/views">cancel</a>
</form>
</section>
{{end}}

View File

@@ -1,70 +0,0 @@
{{define "content"}}
<h1>Views</h1>
<p class="muted">Saved bundles of (filter + view_type + sort + group_by). Page-agnostic — open one to render the saved set on the matching page.</p>
<section class="views-list">
{{if .Views}}
<table>
<thead>
<tr>
<th>★</th><th>Name</th><th>Type</th><th>Default for</th><th>Group by</th><th></th>
</tr>
</thead>
<tbody>
{{range .Views}}
<tr>
<td>{{if .Pinned}}★{{end}}</td>
<td><a href="/views/{{.ID}}">{{.Name}}</a>{{if .Description}}<br><small class="muted">{{.Description}}</small>{{end}}</td>
<td>{{.ViewType}}</td>
<td>{{if .IsDefaultFor}}{{deref .IsDefaultFor}}{{else}}<span class="muted">—</span>{{end}}</td>
<td>{{if .GroupBy}}{{deref .GroupBy}}{{else}}<span class="muted">—</span>{{end}}</td>
<td>
<a href="/views/{{.ID}}/edit">edit</a>
<form method="post" action="/views/{{.ID}}/delete" style="display:inline">
<button type="submit" class="link-button" onclick="return confirm('Delete view {{.Name}}?')">delete</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<p class="empty muted"><em>No saved views yet. Create one with the form below or via the "Save view…" link on any Views-supporting page.</em></p>
{{end}}
</section>
<section class="views-create">
<h2>New view</h2>
<form method="post" action="/views">
<label>Name <input type="text" name="name" required maxlength="80"></label>
<label>Description <input type="text" name="description" maxlength="200"></label>
<label>View type
<select name="view_type" required>
{{range .AllViewTypes}}<option value="{{.}}">{{.}}</option>{{end}}
</select>
</label>
<label>Default for
<select name="is_default_for">
{{range .DefaultForOptions}}<option value="{{.}}">{{if eq . ""}}—{{else}}{{.}}{{end}}</option>{{end}}
</select>
</label>
<label>Group by
<select name="group_by">
{{range .GroupByOptions}}<option value="{{.}}">{{if eq . ""}}—{{else}}{{.}}{{end}}</option>{{end}}
</select>
</label>
<label>Sort field <input type="text" name="sort_field" placeholder="title / updated_at / start_time" maxlength="40"></label>
<label>Sort dir
<select name="sort_dir">
{{range .SortDirOptions}}<option value="{{.}}">{{if eq . ""}}—{{else}}{{.}}{{end}}</option>{{end}}
</select>
</label>
<label><input type="checkbox" name="pinned" value="1"> Pinned</label>
<label>Filter (URL query form, e.g. <code>tag=work&amp;mgmt=mai</code>)
<input type="text" name="filter_query" placeholder="tag=work&mgmt=mai" value="{{.Prefill.filter}}">
</label>
<button type="submit">Create view</button>
</form>
</section>
{{end}}