Complete tasks 4.1-4.2: Page management service and HTTP endpoints

- Implemented PageService with full CRUD operations
- Added GetPages, CreatePage, UpdatePage, DeletePage, ReorderPages methods
- Cascade deletion of widgets when page is deleted
- Prevention of last page deletion
- Created page HTTP endpoints (GET, POST, PUT, DELETE, reorder)
- HTMX-friendly HTML fragment responses
- Comprehensive unit tests for service and handlers
- Updated dashboard to use PageService and create default pages
This commit is contained in:
2026-02-19 00:08:05 -05:00
parent 9f07b0c6f9
commit 299ac03939
16 changed files with 1572 additions and 31 deletions

View File

@@ -48,19 +48,7 @@
<!-- Page Tabs -->
<div id="page-tabs" class="flex space-x-1 -mb-px">
{{range .Pages}}
<button hx-get="/pages/{{.ID}}"
hx-target="#widget-grid"
hx-swap="innerHTML"
class="px-4 py-2 text-sm font-medium {{if .Active}}border-b-2 border-blue-500 text-blue-600{{else}}text-gray-600 hover:text-gray-800{{end}}">
{{.Name}}
</button>
{{end}}
<button class="px-4 py-2 text-sm font-medium text-gray-400 hover:text-gray-600">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
</svg>
</button>
{{template "page-tabs.html" .}}
</div>
</div>
</header>