swirl/views/system/role/edit.jet
2018-03-16 16:50:03 +08:00

83 lines
2.8 KiB
Go

{{ extends "_base" }}
{{ import "../../_modules/form" }}
{{ block script() }}
<script>$(() => new Swirl.Role.EditPage())</script>
{{ end }}
{{ 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/role/">{{ i18n("menu.role") }}</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">
{{ .Role.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/role/{{.Role.ID}}/detail">{{ i18n("menu.detail") }}</a>
<a class="navbar-item is-tab is-active" href="/system/role/{{.Role.ID}}/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/role/">
<div class="field">
<label class="label">{{ i18n("field.name") }}</label>
<div class="control">
<input name="name" value="{{.Role.Name}}" class="input" placeholder="Role name" data-v-rule="native" required>
</div>
</div>
<div class="field">
<label class="label">Description</label>
<div class="control">
<textarea name="desc" class="textarea" placeholder="Remark">{{.Role.Description}}</textarea>
</div>
</div>
<div class="field">
<label class="label">Permissions</label>
<div class="control">
<table id="table-perms" class="table is-bordered is-fullwidth">
<tbody>
{{ cps := .CheckedPerms }}
{{range .Perms}}
<tr>
<th width="150" class="is-vertical-middle has-bg-white-ter">
{{ yield checkbox(id="cb-"+lower(.Name), label=.Name) content}} data-form-ignore="true" data-action="check-row"{{ end }}
</th>
<td>
<div class="columns is-mobile is-multiline is-tight">
{{range .Perms}}
<div class="column is-one-quarter-desktop is-one-third-tablet is-half-mobile">
{{ yield checkbox(name="perms", value=.Key, label=.Text, checked=isset(cps[.Key])) content}} data-action="check"{{ end }}
</div>
{{end}}
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
{{ yield form_submit(url="/system/role/") }}
</form>
</div>
</section>
{{ end }}