fix conflict
This commit is contained in:
commit
00b8012edf
15 changed files with 99 additions and 32 deletions
7
template/components/content_badge.go
Normal file
7
template/components/content_badge.go
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package components
|
||||||
|
|
||||||
|
type ContentBadge struct {
|
||||||
|
Text string
|
||||||
|
TypeClass string // type primary, secondary, success, danger, warning, info, light, dark, (default secondary)
|
||||||
|
IsOutline bool
|
||||||
|
}
|
7
template/components/content_badge.html
Normal file
7
template/components/content_badge.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{{define "content_badge"}}
|
||||||
|
<span class="badge {{if eq .IsOutline true}}
|
||||||
|
border border-{{.TypeClass}} bg-{{.TypeClass}}-subtle text-{{.TypeClass}}-emphasis
|
||||||
|
{{else}}
|
||||||
|
text-bg-{{if .TypeClass}}{{.TypeClass}}{{else}}secondary{{end}}
|
||||||
|
{{end}} rounded-pill ">{{.Text}}</span>
|
||||||
|
{{end}}
|
15
template/components/content_dropdown.go
Normal file
15
template/components/content_dropdown.go
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package components
|
||||||
|
|
||||||
|
type ContentDropdown struct {
|
||||||
|
Label string
|
||||||
|
TypeClass string // type primary, secondary, success, danger, warning, info, light, dark, link, outline-primary
|
||||||
|
IsDisabled bool
|
||||||
|
Items []ContentDropdownItem
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContentDropdownItem struct {
|
||||||
|
Text string
|
||||||
|
Link string
|
||||||
|
IsDisabled bool
|
||||||
|
IsActive bool
|
||||||
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
{{define "form_dropdown_item"}}
|
{{define "content_dropdown_item"}}
|
||||||
<li><a class="dropdown-item {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}" href="{{.Link}}">{{.Text}}</a></li>
|
<li><a class="dropdown-item {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}" href="{{.Link}}">{{.Text}}</a></li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "form_dropdown"}}
|
{{define "content_dropdown"}}
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-{{.TypeClass}} dropdown-toggle {{if eq .IsDisabled true}}disabled{{end}}" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<button class="btn btn-{{.TypeClass}} dropdown-toggle {{if eq .IsDisabled true}}disabled{{end}}" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
{{.Label}}
|
{{.Label}}
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
{{ range .Items}}
|
{{ range .Items}}
|
||||||
{{template "form_dropdown_item" .}}
|
{{template "content_dropdown_item" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
|
@ -1,6 +1,6 @@
|
||||||
package components
|
package components
|
||||||
|
|
||||||
type FormHref struct {
|
type ContentHref struct {
|
||||||
Text string
|
Text string
|
||||||
Link string
|
Link string
|
||||||
Icon string
|
Icon string
|
|
@ -1,4 +1,4 @@
|
||||||
{{define "form_href"}}
|
{{define "content_href"}}
|
||||||
<a class="{{if eq .IsButton true}} btn btn-{{.TypeClass}}{{end}} {{if eq .IsDisabled true}}disabled{{end}}"
|
<a class="{{if eq .IsButton true}} btn btn-{{.TypeClass}}{{end}} {{if eq .IsDisabled true}}disabled{{end}}"
|
||||||
href="{{.Link}}" {{if eq .IsButton true}}role="button"{{end}} {{if eq .IsDisabled true}}aria-disabled="true"{{end}}>
|
href="{{.Link}}" {{if eq .IsButton true}}role="button"{{end}} {{if eq .IsDisabled true}}aria-disabled="true"{{end}}>
|
||||||
{{.Text}}
|
{{.Text}}
|
19
template/components/content_list.go
Normal file
19
template/components/content_list.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package components
|
||||||
|
|
||||||
|
type ContentList struct {
|
||||||
|
Items []ContentListItem
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContentListItem struct {
|
||||||
|
Text string
|
||||||
|
Description string
|
||||||
|
EndElement string
|
||||||
|
//Link string
|
||||||
|
TypeClass string // primary, secondary, success, danger, warning, info, light, dark
|
||||||
|
IsDisabled bool
|
||||||
|
//IsActive bool
|
||||||
|
}
|
||||||
|
|
||||||
|
//link
|
||||||
|
//border
|
||||||
|
// badge
|
14
template/components/content_list.html
Normal file
14
template/components/content_list.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{{define "content_list"}}
|
||||||
|
<ul class="list-group">
|
||||||
|
{{ range .Items}}
|
||||||
|
<li class="list-group-item text-wrap {{if eq .IsDisabled true}}disabled{{end}} {{if .TypeClass}}list-group-item-{{.TypeClass}}{{end}}"
|
||||||
|
{{if eq .IsDisabled true}}aria-disabled="true"{{end}}
|
||||||
|
><div class="d-flex justify-content-between lh-sm"><p class="mb-1">{{.Text}}</p><span class="text-body-secondary ms-5">{{.EndElement}}</span></div>
|
||||||
|
<small>{{.Description}}</small>
|
||||||
|
</li>
|
||||||
|
{{end}}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{{end}}
|
|
@ -2,16 +2,19 @@ package components
|
||||||
|
|
||||||
type ContentTable struct {
|
type ContentTable struct {
|
||||||
ID string
|
ID string
|
||||||
|
TableClass string // table-primary, table-secondary,.. table-striped table-bordered
|
||||||
|
HeadClass string // table-dark table-light
|
||||||
AllTH []ContentTableTH
|
AllTH []ContentTableTH
|
||||||
AllTD [][]ContentTableTD
|
AllTD [][]ContentTableTD
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContentTableTH struct {
|
type ContentTableTH struct {
|
||||||
ID string
|
ID string
|
||||||
|
ValueType string // -> default string, href, badge
|
||||||
Value string
|
Value string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContentTableTD struct {
|
type ContentTableTD struct {
|
||||||
ID string
|
ID string
|
||||||
Value string
|
Value interface{} // string or component struct according ValueType
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,25 @@
|
||||||
{{define "content_table"}}
|
{{define "content_table"}}
|
||||||
<table class="table table-hover" {{ if .ID }}id="{{.ID}}"{{end}}>
|
<table class="table table-hover {{.TableClass}}" {{ if .ID }}id="{{.ID}}"{{end}}>
|
||||||
<thead>
|
<thead class="{{.HeadClass}}">
|
||||||
<tr>
|
<tr>
|
||||||
{{range $index, $col := .AllTH}}<th {{ if .ID }}id="{{.ID}}"{{end}} scope="col">{{ $col.Value }}</th>{{end}}
|
{{range $index, $col := .AllTH}}<th {{ if .ID }}id="{{.ID}}"{{end}} scope="col">{{ $col.Value }}</th>{{end}}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{- range .AllTD}}<tr scope="row">{{range .}}<td {{ if .ID }}id="{{.ID}}"{{end}}>{{ .Value }}</td>{{end}}</tr>{{- end}}
|
{{- range .AllTD}}<tr scope="row">
|
||||||
|
{{range $index, $item := .}}<td {{ if $item.ID }}id="{{$item.ID}}"{{end}}>
|
||||||
|
{{ with $x := index $.AllTH $index }}
|
||||||
|
{{ if eq $x.ValueType "href"}}
|
||||||
|
{{template "content_href" $item.Value}}
|
||||||
|
{{ else if eq $x.ValueType "badge"}}
|
||||||
|
{{template "content_badge" $item.Value}}
|
||||||
|
{{ else }}
|
||||||
|
{{ $item.Value }}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
</td>
|
||||||
|
{{end}}</tr>
|
||||||
|
{{- end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{end}}
|
{{end}}
|
|
@ -1,15 +0,0 @@
|
||||||
package components
|
|
||||||
|
|
||||||
type FormDropdown struct {
|
|
||||||
Label string
|
|
||||||
TypeClass string
|
|
||||||
IsDisabled bool
|
|
||||||
Items []FormDropdownItem
|
|
||||||
}
|
|
||||||
|
|
||||||
type FormDropdownItem struct {
|
|
||||||
Text string
|
|
||||||
Link string
|
|
||||||
IsDisabled bool
|
|
||||||
IsActive bool
|
|
||||||
}
|
|
|
@ -9,4 +9,5 @@ type FormInput struct {
|
||||||
Hint string
|
Hint string
|
||||||
Error string
|
Error string
|
||||||
IsDisabled bool
|
IsDisabled bool
|
||||||
|
IsRequired bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
{{if eq .IsDisabled true}}
|
{{if eq .IsDisabled true}}
|
||||||
disabled
|
disabled
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if eq .IsRequired true}}
|
||||||
|
required
|
||||||
|
{{end}}
|
||||||
{{if ne .Value ""}}
|
{{if ne .Value ""}}
|
||||||
value="{{.Value}}"
|
value="{{.Value}}"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package components
|
package components
|
||||||
|
|
||||||
type PageNav struct {
|
type PageNav struct {
|
||||||
NavClass string // nav-pills
|
NavClass string // nav-pills, nav-underline
|
||||||
NavItems []PageNavItem
|
NavItems []PageNavItem
|
||||||
IsVertical bool
|
IsVertical bool
|
||||||
IsTab bool
|
IsTab bool
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
class="nav-link dropdown-toggle {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}">{{$item.Text}}</a>
|
class="nav-link dropdown-toggle {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}">{{$item.Text}}</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
{{ range $item.ChildItems}}
|
{{ range $item.ChildItems}}
|
||||||
{{template "form_dropdown_item" .}}
|
{{template "content_dropdown_item" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue