1
0
Fork 0
forked from goffee/core

develop #1

Merged
diana merged 5 commits from goffee/core:develop into develop 2024-10-12 13:47:51 -04:00
8 changed files with 87 additions and 0 deletions
Showing only changes of commit 8f17bf6a8c - Show all commits

View file

@ -0,0 +1,14 @@
package components
type FormCheckbox struct {
Label string
AllCheckbox []FormCheckboxItem
}
type FormCheckboxItem struct {
ID string
Name string
Value string
Label string
IsChecked bool
}

View file

@ -0,0 +1,11 @@
{{define "form_checkbox"}}
<div class="input-container">
<label class="form-label">{{.Label}}</label>
{{range $options := .AllCheckbox}}
<div class="form-check">
<input class="form-check-input" type="checkbox" name="{{$options.Name}}" id="{{$options.ID}}" value="{{$options.Value}}"{{if eq $options.IsChecked true}} checked{{end}}>
<label class="form-check-label" for="{{$options.ID}}">{{$options.Label}}</label>
</div>
{{end}}
</div>
{{end}}

View file

@ -0,0 +1,15 @@
package components
type FormRadio struct {
Label string
AllRadios []FormRadioItem
}
type FormRadioItem struct {
ID string
Name string
Value string
Label string
IsDisabled bool
IsChecked bool
}

View file

@ -0,0 +1,11 @@
{{define "form_radio"}}
<div class="input-container">
<label class="form-label">{{.Label}}</label>
{{range $options := .AllRadios}}
<div class="form-check{{if eq $options.IsDisabled true}} disabled{{end}}">
<input class="form-check-input" type="radio" name="{{$options.Name}}" id="{{$options.ID}}" value="{{$options.Value}}"{{if eq $options.IsDisabled true}} disabled=""{{end}}{{if eq $options.IsChecked true}} checked=""{{end}}>
<label class="form-check-label" for="{{$options.ID}}">{{$options.Label}}</label>
</div>
{{end}}
</div>
{{end}}

View file

@ -0,0 +1,13 @@
package components
type FormSelect struct {
ID string
SelectedOption FormSelectOption
Label string
AllOptions []FormSelectOption
}
type FormSelectOption struct {
Value string
Caption string
}

View file

@ -0,0 +1,10 @@
{{define "form_select"}}
<div class="input-container">
<label for="{{.ID}}" class="form-label">{{.Label}}</label>
<select class="form-select" id="{{.ID}}" name="{{.ID}}">
{{range $options := .AllOptions}}
<option value="{{$options.Value}}" {{if eq $options.Value $.SelectedOption.Value }}selected="selected"{{end}}>{{$options.Caption}}</option>
{{end}}
</select>
</div>
{{end}}

View file

@ -0,0 +1,7 @@
package components
type FormTextarea struct {
ID string
Label string
AllOptions []FormSelectOption
}

View file

@ -0,0 +1,6 @@
{{define "form_textarea"}}
<div class="input-container">
<label for="{{.ID}}" class="form-label">{{.Label}}</label>
<textarea class="form-control" id="{{.ID}}" name="{{.ID}}" rows="3"></textarea>
</div>
{{end}}