Per m's Q1 pick (b) (2026-05-29): legacy `/`, `/dashboard`, `/calendar`,
`/timeline`, `/graph` become `/views/{system-slug}`. Old routes
301-redirect to the new ones with chip params preserved; the legacy
?view=<uuid> param from 5i is resolved through the uuid → slug map
when present so old bookmarks land on the right user view.
System views (web/system_views.go):
- SystemView struct (Slug / Name / Icon / URL) — code-resident, never
rows in projax.views.
- AllSystemViews() returns the canonical five: tree, dashboard,
calendar, timeline, graph. Display order matches the existing
sidebar.
- LookupSystemView(slug) returns the matching entry or nil; the
reserved-slug list in store.IsReservedViewSlug (slice A) is kept
in sync.
- legacyRedirect(systemSlug) handler 301s with chip-param preservation
+ uuid → slug resolution for any leftover ?view=<uuid>.
Routes (web/server.go):
- GET /views/tree → handleTree (was GET /)
- GET /views/dashboard → handleDashboard
- GET /views/timeline → handleTimeline
- GET /views/calendar → handleCalendar
- GET /views/graph → handleGraph
- GET / → 301 → /views/tree
- GET /dashboard → 301 → /views/dashboard
- GET /timeline → 301 → /views/timeline
- GET /calendar → 301 → /views/calendar
- GET /graph → 301 → /views/graph
- POST action endpoints (/dashboard/task/*, /dashboard/pin, /admin/*)
stay where they are — those are RPC-ish, not page renders.
handleTree: dropped the `r.URL.Path != "/"` guard — the only entry
point now is /views/tree, mounted via the new route. Slice F removes
any residual references; this slice keeps the handler reachable.
computeChipCounts grew a `base string` arg so chip URLs anchor on the
caller's route (/views/tree for the system tree, /views/{slug} for
saved views). PageViewTypes recognises both legacy and /views/ keys
during the transition.
Template hrefs / hx-gets bulk-updated to the new URLs:
- layout.tmpl: every sidebar + bottom-nav entry points at
/views/{system-slug}. Active-state checks updated alongside.
- tree_section.tmpl, tree_card.tmpl, tree_kanban.tmpl: clear-filter
/ clear-all hrefs → /views/tree.
- calendar*.tmpl, timeline_section.tmpl, graph.tmpl,
dashboard_section.tmpl: every internal nav + filter link points at
the /views/{slug} surface.
- detail.tmpl, error.tmpl: cancel / back-to-tree → /views/tree.
Test-source updates (per the 5c sharpened rule):
- ~100 test paths bulk-rewritten from /dashboard /calendar /timeline
/graph (and `/`) to their /views/{slug} counterparts. The
behaviour-preservation contract holds: status codes + body shapes
for the rendered pages stay the same; only the URL anchoring the
test changes.
- layout_test.go: sidebar href assertions updated to /views/{slug}.
- view_type_test.go (Q2 + Q3 follow-up): PageViewTypes lookup table
updated to use the new route keys.
- 2 deliberate behaviour-change assertions land: TestLegacyRedirects
expects 301 on the old URLs (was 200); TestTreeRenders fetches
/views/tree (the new home) instead of /.
Internal go-source URL emissions (dashboard.go, calendar.go,
timeline.go) updated to the new BasePath so chip + refresh URLs round
through /views/{slug} correctly.
New tests:
- TestSystemViewLookup — AllSystemViews shape + LookupSystemView
round-trip + unknown-slug nil.
- TestLegacyRedirects — every legacy URL 301s to its new home with
chip params preserved.
- TestLegacyViewUUIDRedirect — old `?view=<uuid>` URLs land on the
resolved slug per m's Q3 pick.
97 lines
4.0 KiB
Cheetah
97 lines
4.0 KiB
Cheetah
{{define "calendar-section"}}
|
|
<div id="calendar-section" class="calendar-section">
|
|
|
|
<section class="tagbar" id="calendar-filterbar">
|
|
<form id="calendar-filter" class="search"
|
|
hx-get="/views/calendar"
|
|
hx-target="#calendar-section"
|
|
hx-swap="outerHTML"
|
|
hx-trigger="change from:select"
|
|
hx-push-url="true">
|
|
<input type="hidden" name="month" value="{{.P.MonthKey}}">
|
|
<label>tag
|
|
<select name="tag" multiple size="3">
|
|
{{range $.Filter.Tags}}<option value="{{.}}" selected>{{.}}</option>{{end}}
|
|
</select>
|
|
</label>
|
|
<label>mgmt
|
|
<select name="mgmt" multiple size="3">
|
|
{{$selM := .Filter.Management}}
|
|
<option value="mai" {{if contains $selM "mai"}}selected{{end}}>mai</option>
|
|
<option value="self" {{if contains $selM "self"}}selected{{end}}>self</option>
|
|
<option value="external" {{if contains $selM "external"}}selected{{end}}>external</option>
|
|
</select>
|
|
</label>
|
|
<label>has
|
|
<select name="has" multiple size="2">
|
|
{{$selH := .Filter.HasLinks}}
|
|
<option value="caldav-list" {{if contains $selH "caldav-list"}}selected{{end}}>caldav</option>
|
|
<option value="gitea-repo" {{if contains $selH "gitea-repo"}}selected{{end}}>gitea</option>
|
|
</select>
|
|
</label>
|
|
<label>kind
|
|
<select name="kind" multiple size="3">
|
|
{{$selK := .P.Kinds}}
|
|
<option value="event" {{if contains $selK "event"}}selected{{end}}>event</option>
|
|
<option value="todo" {{if contains $selK "todo"}}selected{{end}}>todo</option>
|
|
<option value="doc" {{if contains $selK "doc"}}selected{{end}}>doc</option>
|
|
</select>
|
|
</label>
|
|
{{if .Filter.ProjectPath}}<input type="hidden" name="project" value="{{.Filter.ProjectPath}}">{{end}}
|
|
{{if and .Filter.ProjectPath (not .Filter.IncludeDescendants)}}<input type="hidden" name="project_descendants" value="0">{{end}}
|
|
{{if .Filter.Active}}<a class="clear" href="/views/calendar?month={{.P.MonthKey}}">clear filters</a>{{end}}
|
|
</form>
|
|
|
|
{{template "view-project-chip" .}}
|
|
|
|
<p class="counts muted">
|
|
<small>{{.P.TotalRows}} {{if eq .P.TotalRows 1}}row{{else}}rows{{end}}</small>
|
|
{{if .P.Cached}}<small title="Served from 60s in-memory cache · built {{.P.BuiltAt.Format "15:04:05"}}">· cached</small>{{else}}<small>· fresh</small>{{end}}
|
|
</p>
|
|
</section>
|
|
|
|
<table class="calendar-grid" role="grid">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Mon</th>
|
|
<th scope="col">Tue</th>
|
|
<th scope="col">Wed</th>
|
|
<th scope="col">Thu</th>
|
|
<th scope="col">Fri</th>
|
|
<th scope="col">Sat</th>
|
|
<th scope="col">Sun</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .P.Weeks}}
|
|
<tr class="calendar-week">
|
|
{{range .Days}}
|
|
<td class="calendar-cell{{if .IsToday}} is-today{{end}}{{if .IsAdjacent}} adjacent-month{{end}}" data-date="{{.DateKey}}">
|
|
<div class="cell-header">
|
|
<span class="day-num">{{.DayNum}}</span>
|
|
<span class="day-label">{{.LongLabel}}</span>
|
|
{{if .IsToday}}<span class="today-pill">Heute</span>{{end}}
|
|
</div>
|
|
{{if .Rows}}
|
|
<ul class="cell-rows">
|
|
{{range .Rows}}
|
|
<li class="cell-row row-{{.Kind}}{{if .Overdue}} overdue{{end}}">
|
|
{{if .Time}}<span class="time">{{.Time}}</span>{{end}}
|
|
<a class="row-link" href="/i/{{.ItemPath}}" title="{{.ItemPath}}">{{.Summary}}</a>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{end}}
|
|
{{if gt .ExtraCount 0}}
|
|
<a class="cell-more muted" href="/views/timeline?from={{.DateKey}}&to={{.DateKey}}">+{{.ExtraCount}} more</a>
|
|
{{end}}
|
|
</td>
|
|
{{end}}
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
{{end}}
|