Files
davidandClaude Opus 5.5 2b9d04297f Phase 10, part 5: access enforced on every page, form and fragment
One table maps every address to an area (a module, Settings, anything
signed in, or public); each route is checked against it, and the app won't
start with a route missing from it. Changing needs edit on the module. For
members who may only view, forms that would change something are shown
disabled and htmx buttons hidden. The menu, the Overview, Search and the
SEO emails follow each person's modules; Settings is for admins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 09:13:16 -07:00

68 lines
2.1 KiB
HTML

{{define "content"}}{{$inbox := .Inbox}}{{with .Data}}
<div class="page-head">
<h1>Overview</h1>
<p class="lede">Supermarket's modules, and what's left to set up.</p>
</div>
{{template "reminders" .Reminders}}
<div class="grid">
{{range .Modules}}
{{if .Link}}
<a class="card module" href="{{.Link}}">
<h3>{{template "icon" .ID}}{{.Name}}</h3>
<p>{{.Body}}</p>
{{if eq .ID "content"}}<span class="stat">{{if $inbox}}{{$inbox}} waiting in Posts{{else}}No posts waiting{{end}}{{with $.Data.Scheduled}} · {{.}} scheduled{{end}}</span>{{end}}
</a>
{{else}}
<section class="card module later">
<h3>{{template "icon" .ID}}{{.Name}}</h3>
<p>{{.Body}}</p>
</section>
{{end}}
{{end}}
</div>
{{if not .Modules}}
<section class="card empty"><p>You don't have any modules yet. An admin can give you some, under Settings → Users.</p></section>
{{end}}
{{if not .Admin}}
{{else if .Pending}}
<section class="card">
<h2>Setup</h2>
<ul class="steps">
{{range .Steps}}
<li class="{{if .Done}}done{{else}}todo{{end}}">
<a href="{{.Link}}"><strong>{{.Label}}</strong></a>
<span>{{.Detail}}</span>
</li>
{{end}}
</ul>
</section>
{{else}}
<details class="card">
<summary>Setup: all done</summary>
<ul class="steps">
{{range .Steps}}
<li class="done"><a href="{{.Link}}"><strong>{{.Label}}</strong></a><span>{{.Detail}}</span></li>
{{end}}
</ul>
</details>
{{end}}
{{if not .Admin}}
{{else if .ImportErr}}
<section class="card warn">
<h2>Import from the old app failed</h2>
<p>{{.ImportErr}}</p>
<p>The old files are untouched in the data folder's <code>import/</code> directory. Fix the file named above and restart Supermarket (<code>supermarket restart</code>) to try again.</p>
</section>
{{else if .ImportStatus}}
<details class="card">
<summary>Imported from the old terminal app {{ago .ImportStatus.At}}</summary>
<ul>{{range .ImportStatus.Summary}}<li>{{.}}</li>{{end}}</ul>
{{if .QueuedPosts}}<p>Its queued posts are now drafts: <a href="/posts">{{.QueuedPosts}} waiting in Posts</a>.</p>{{end}}
</details>
{{end}}
{{end}}{{end}}