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:
21
templates/partials/page-tabs.html
Normal file
21
templates/partials/page-tabs.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{define "page-tabs.html"}}
|
||||
{{range .Pages}}
|
||||
<button hx-get="/pages/{{.ID}}"
|
||||
hx-target="#widget-grid"
|
||||
hx-swap="innerHTML"
|
||||
hx-push-url="false"
|
||||
data-page-id="{{.ID}}"
|
||||
class="page-tab px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 border-b-2 border-transparent hover:border-gray-300 transition-colors">
|
||||
{{.Name}}
|
||||
</button>
|
||||
{{end}}
|
||||
<button hx-get="/pages/new-form"
|
||||
hx-target="#page-form-modal"
|
||||
hx-swap="innerHTML"
|
||||
class="px-4 py-2 text-sm font-medium text-gray-400 hover:text-gray-600 transition-colors"
|
||||
title="Add new page">
|
||||
<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>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user