swirl/views/system/role/new.jet
2021-02-26 13:32:05 +08:00

55 lines
1.9 KiB
Go

{{ extends "base" }}
{{ import "../../_modules/form" }}
{{ block script() }}
<script>$(() => new Swirl.Role.NewPage())</script>
{{ end }}
{{ block body_content() }}
<section class="section">
<div class="container">
<h2 class="title">Create role</h2>
<hr>
<form method="post" data-form="ajax-json" data-url="/system/role/">
<div class="field">
<label class="label">{{ i18n("field.name") }}</label>
<div class="control">
<input name="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"></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>
{{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) 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 }}