mirror of
https://github.com/cuigh/swirl
synced 2025-01-03 17:42:29 +00:00
105 lines
3.7 KiB
Go
105 lines
3.7 KiB
Go
{{ extends "base" }}
|
|
{{ import "../../_modules/pager" }}
|
|
|
|
{{ block script() }}
|
|
<script>$(() => new Swirl.User.ListPage())</script>
|
|
{{ end }}
|
|
|
|
{{ block body_content() }}
|
|
<section class="section">
|
|
<nav class="level">
|
|
<!-- Left side -->
|
|
<div class="level-left">
|
|
<div class="level-item">
|
|
<form>
|
|
<input name="filter" value="{{.Filter}}" type="hidden">
|
|
<div class="field has-addons">
|
|
<p class="control">
|
|
<input name="query" value="{{.Query}}" class="input" type="text" placeholder="Search by name, login name and email">
|
|
</p>
|
|
<p class="control">
|
|
<button type="submit" class="button is-primary">{{ i18n("button.search") }}</button>
|
|
</p>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="level-item">
|
|
<p class="subtitle is-5">
|
|
<strong>{{.Pager.Count}}</strong>
|
|
<span class="is-lowercase">{{ i18n("menu.user") }}</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<!-- Right side -->
|
|
<div class="level-right">
|
|
<p class="level-item">
|
|
{{if .Filter == ""}}
|
|
<strong>All</strong>
|
|
{{else}}
|
|
<a href="/system/user/">All</a>
|
|
{{end}}
|
|
</p>
|
|
<p class="level-item">
|
|
{{if .Filter == "admins"}}
|
|
<strong>Admins</strong>
|
|
{{else}}
|
|
<a href="?filter=admins">Admins</a>
|
|
{{end}}
|
|
</p>
|
|
<p class="level-item">
|
|
{{if .Filter == "active"}}
|
|
<strong>Active</strong>
|
|
{{else}}
|
|
<a href="?filter=active">Active</a>
|
|
{{end}}
|
|
</p>
|
|
<p class="level-item">
|
|
{{if .Filter == "blocked"}}
|
|
<strong>Blocked</strong>
|
|
{{else}}
|
|
<a href="?filter=blocked">Blocked</a>
|
|
{{end}}
|
|
</p>
|
|
<p class="level-item">
|
|
<a href="new" class="button is-success"><span class="icon"><i class="fas fa-plus"></i></span><span>{{ i18n("button.new") }}</span></a>
|
|
</p>
|
|
</div>
|
|
</nav>
|
|
|
|
<table id="table-items" class="table is-bordered is-striped is-hoverable is-narrow is-fullwidth">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ i18n("field.name") }}</th>
|
|
<th>{{ i18n("field.login-name") }}</th>
|
|
<th>{{ i18n("field.email") }}</th>
|
|
<th>{{ i18n("field.type") }}</th>
|
|
<th>{{ i18n("field.status") }}</th>
|
|
<th>{{ i18n("field.created-at") }}</th>
|
|
<th>{{ i18n("field.action") }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Users}}
|
|
<tr data-id="{{.ID}}">
|
|
<td><a href="{{.LoginName}}/detail">{{.Name}}</a>{{ if .Admin }}<span class="icon has-text-danger tooltip" data-tooltip="Administrator"><i class="fas fa-flag"></i></span>{{ end }}</td>
|
|
<td>{{.LoginName}}</td>
|
|
<td>{{.Email}}</td>
|
|
<td>{{.Type}}</td>
|
|
<td><span class="tag is-{{.Status == 1 ? "success" : "warning"}}">{{.Status == 1 ? "Active" : "Blocked"}}</span></td>
|
|
<td>{{time(.CreatedAt)}}</td>
|
|
<td>
|
|
<a href="{{.LoginName}}/edit" class="button is-small is-dark is-outlined">{{ i18n("button.edit") }}</a>
|
|
{{if .Status == 1}}
|
|
<button class="button is-small is-warning is-outlined" data-action="block-user">{{ i18n("user.button.block") }}</button>
|
|
{{else}}
|
|
<button class="button is-small is-warning is-outlined" data-action="unblock-user">{{ i18n("user.button.unblock") }}</button>
|
|
{{end}}
|
|
<button class="button is-small is-danger is-outlined" data-action="delete-user">{{ i18n("button.delete") }}</button>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{ yield pager(info=.Pager) }}
|
|
</section>
|
|
{{ end }} |