Merge pull request 'develop' (#23) from develop into main

Reviewed-on: goffee/core#23
This commit is contained in:
Zeni Kim 2025-04-17 02:52:54 -04:00
commit f1772b99f3
6 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,9 @@
package components
type ContentPagination struct {
PageStartRecord int
PageEndRecord int
TotalRecords int
PrevLink string
NextLink string
}

View file

@ -0,0 +1,10 @@
{{define "content_pagination"}}
<div class="pagination-container">
<ul class="pagination pagination-sm">
<li class="page-item">{{.PageStartRecord}} - {{.PageEndRecord}} of {{.TotalRecords}}</li>
<li class="page-item">&nbsp;</li>
<li class="page-item"><a class="page-link{{if eq .PrevLink ""}} disabled"{{else}}" href="{{.PrevLink}}"{{end}}>«</a></li>
<li class="page-item"><a class="page-link{{if eq .NextLink ""}} disabled"{{else}}" href="{{.NextLink}}"{{end}}>»</a></li>
</ul>
</div>
{{end}}

View file

@ -11,4 +11,10 @@ type FormInput struct {
IsDisabled bool
Autocomplete bool
IsRequired bool
CustomAtt []CustomAtt
}
type CustomAtt struct {
AttName string
AttValue string
}

View file

@ -14,6 +14,11 @@
{{if ne .Value ""}}
value="{{.Value}}"
{{end}}
{{if .CustomAtt }}
{{range $options := .CustomAtt}}
{{$options.AttName}}="{{$options.AttValue}}"
{{end}}
{{end}}
aria-describedby="{{.ID}}Help">
{{if ne .Hint ""}}<small id="{{.ID}}Help" class="form-text text-muted">{{.Hint}}</small>{{end}}
{{if ne .Error ""}}<div class="error">{{.Error}}</div>{{end}}

View file

@ -5,6 +5,7 @@ type FormSelect struct {
SelectedOption FormSelectOption
Label string
AllOptions []FormSelectOption
IsMultiple bool
}
type FormSelectOption struct {

View file

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