swirl/views/system/user/edit.jet
2018-04-16 20:47:20 +08:00

85 lines
3.0 KiB
Go

{{ extends "_base" }}
{{ import "../../_modules/form" }}
{{ block body_content() }}
<div class="container">
<nav class="breadcrumb has-succeeds-separator is-small is-marginless" aria-label="breadcrumbs">
<ul>
<li><a href="/">{{ i18n("menu.home") }}</a></li>
<li><a href="/system/user/">{{ i18n("menu.user") }}</a></li>
<li class="is-active"><a>{{ i18n("menu.edit") }}</a></li>
</ul>
</nav>
</div>
<section class="hero is-small is-light">
<div class="hero-body">
<div class="container">
<h2 class="title is-2">
{{ .User.Name }}
</h2>
</div>
</div>
</section>
<nav class="navbar has-shadow">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item is-tab" href="/system/user/{{.User.LoginName}}/detail">{{ i18n("menu.detail") }}</a>
<a class="navbar-item is-tab is-active" href="/system/user/{{.User.LoginName}}/edit">{{ i18n("menu.edit") }}</a>
</div>
</div>
</nav>
<section class="section">
<div class="container">
<form method="post" action="update" data-form="ajax-json" data-url="/system/user/">
<input name="id" value="{{ .User.ID }}" type="hidden">
<div class="columns is-bottom-marginless">
<div class="column is-6">
<div class="field">
<label class="label">{{ i18n("field.name") }}</label>
<div class="control has-icons-left">
<input name="name" value="{{ .User.Name }}" class="input" placeholder="Name" data-v-rule="native" required>
<span class="icon is-small is-left">
<i class="fas fa-user"></i>
</span>
</div>
</div>
</div>
<div class="column is-6">
<div class="field">
<label class="label">{{ i18n("field.email") }}</label>
<div class="control has-icons-left">
<input name="email" value="{{ .User.Email }}" class="input" placeholder="Email" data-v-rule="native" required>
<span class="icon is-small is-left">
<i class="fas fa-envelope"></i>
</span>
</div>
</div>
</div>
</div>
<div class="field">
{{ yield switch(id="cb-admin", name="admin", label="Administrator", checked=.User.Admin) }}
</div>
<div class="field">
<label class="label">{{ i18n("field.type") }}</label>
<div class="control">
{{ yield radio(name="type", value="internal", label="Internal", checked=.User.Type) }}
{{ yield radio(name="type", value="ldap", label="LDAP", checked=.User.Type) }}
</div>
</div>
<div class="field">
<label class="label">{{ i18n("field.role") }}</label>
<div class="control">
{{ roles := .UserRoles }}
{{range .Roles}}
{{ yield checkbox(name="roles", value=.ID, label=.Name, checked=isset(roles[.ID])) }}
{{end}}
</div>
</div>
{{ yield form_submit(url="/system/user/") }}
</form>
</div>
</section>
{{ end }}