You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.1 KiB

4 weeks ago
{{define "block_table"}}
<section class="panel">
<div class="panel-header panel-header-actions">
<div>
<h2>{{.Title}}</h2>
{{if .Subtitle}}<p>{{.Subtitle}}</p>{{end}}
</div>
<div class="panel-actions compact">
{{if .Table.PrimaryLabel}}
<button
type="button"
class="btn primary"
{{if eq .Title "사용자 계정"}}data-open-modal="user-create"{{else if eq .Title "그룹"}}data-open-modal="group-create"{{else}}data-mock-action="primary-action"{{end}}>
{{.Table.PrimaryLabel}}
</button>
{{end}}
{{if .Table.SecondaryLabel}}<button type="button" class="btn secondary" data-mock-action="secondary-action">{{.Table.SecondaryLabel}}</button>{{end}}
</div>
</div>
<div class="table-wrap">
<table class="data-table">
<thead>
<tr>
{{range .Table.Columns}}<th>{{.}}</th>{{end}}
{{if .Table.Rows}}
{{if (index .Table.Rows 0).Actions}}<th>Operate</th>{{end}}
{{end}}
</tr>
</thead>
<tbody>
{{if .Table.Rows}}
{{range .Table.Rows}}
<tr>
{{range .Cells}}<td>{{.}}</td>{{end}}
{{if .Actions}}
<td class="row-actions">
{{range .Actions}}
<button
type="button"
class="link-action {{.Variant}}"
{{if eq .Action "user-edit"}}data-user-edit="{{.Target}}"{{else if eq .Action "user-delete"}}data-user-delete="{{.Target}}"{{else if eq .Action "group-edit"}}data-group-edit="{{.Target}}"{{else if eq .Action "group-delete"}}data-group-delete="{{.Target}}"{{else}}data-mock-action="{{.Action}}"{{end}}>
{{.Label}}
</button>
{{end}}
</td>
{{end}}
</tr>
{{end}}
{{else}}
<tr><td colspan="{{len .Table.Columns}}" class="empty-state">{{.Table.EmptyMessage}}</td></tr>
{{end}}
</tbody>
</table>
</div>
</section>
{{end}}