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:
29
server/pages/templates/components/file-upload.html
Normal file
29
server/pages/templates/components/file-upload.html
Normal 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}}
|
||||
Reference in New Issue
Block a user