Changeset 0.22.5 (#147)

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit is contained in:
2026-03-03 09:58:23 +00:00
committed by xcaliber
parent 3953dcf364
commit 45fe965c32
32 changed files with 3021 additions and 11 deletions

View File

@@ -0,0 +1,29 @@
{{/*
Reusable file upload component (v0.23.0).
Renders a drop zone + file picker button.
Expects dict with:
FieldName — unique ID for the input (e.g. "workspace-upload")
Label — optional label text
Multiple — bool, allow multiple files
Accept — optional file type filter (e.g. ".md,.txt,.go")
DropZone — bool, show drag-and-drop zone
*/}}
{{define "file-upload"}}
<div class="file-upload-wrap" id="{{.FieldName}}Wrap">
{{if .Label}}<label class="form-group-label">{{.Label}}</label>{{end}}
<input type="file" id="{{.FieldName}}Input"
{{if .Multiple}}multiple{{end}}
{{if .Accept}}accept="{{.Accept}}"{{end}}
style="display:none">
<button type="button" class="btn-small btn-primary"
onclick="document.getElementById('{{.FieldName}}Input').click()">
Choose files…
</button>
{{if .DropZone}}
<div class="file-upload-drop" id="{{.FieldName}}Drop">
Drop files here or click above
</div>
{{end}}
</div>
{{end}}

View File

@@ -0,0 +1,36 @@
{{/*
model-select: Reusable provider + model dropdown pair.
Used in admin roles page with FilterType for model_type filtering.
When provider changes, Pages.roleProviderChanged() filters models
from __PAGE_DATA__.Models on the client side.
*/}}
{{define "model-select"}}
<div class="form-group model-select-group" data-field="{{index . "FieldName"}}">
{{if index . "Label"}}<label>{{index . "Label"}}</label>{{end}}
<div class="form-row" style="gap:8px;align-items:center">
<select name="{{index . "FieldName"}}_provider"
class="model-provider-select"
data-target="{{index . "FieldName"}}_model"
data-filter-type="{{index . "FilterType"}}"
style="min-width:140px">
<option value="">— select provider —</option>
{{$selProv := index . "SelectedProvider"}}
{{range index . "Providers"}}
<option value="{{.ID}}"{{if eq .ID $selProv}} selected{{end}}>{{.Name}}</option>
{{end}}
</select>
<select name="{{index . "FieldName"}}_model"
class="model-model-select"
style="min-width:200px">
<option value="">— select model —</option>
{{$selModel := index . "SelectedModel"}}
{{$filterType := index . "FilterType"}}
{{range index . "Models"}}
{{if and (eq .ProviderConfigID $selProv) (or (eq $filterType "") (eq .ModelType $filterType))}}
<option value="{{.ModelID}}"{{if eq .ModelID $selModel}} selected{{end}}>{{.DisplayName}}</option>
{{end}}
{{end}}
</select>
</div>
</div>
{{end}}

View File

@@ -0,0 +1,18 @@
{{/*
team-select: Reusable team dropdown.
Pre-populated from server data — no client-side fetch needed.
*/}}
{{define "team-select"}}
<div class="form-group">
{{if index . "Label"}}<label>{{index . "Label"}}</label>{{end}}
<select name="{{index . "FieldName"}}" class="team-select">
{{if index . "AllowEmpty"}}
<option value="">— all teams —</option>
{{end}}
{{$sel := index . "Selected"}}
{{range index . "Teams"}}
<option value="{{.ID}}"{{if eq .ID $sel}} selected{{end}}>{{.Name}}</option>
{{end}}
</select>
</div>
{{end}}