cacert-boardvoting/ui/html/pages/edit_user.html

79 lines
4.4 KiB
HTML
Raw Normal View History

2022-06-02 21:14:38 +00:00
{{ define "title" }}Edit User {{ .Form.User.Name }}{{ end }}
{{ define "main" }}
{{ $form := .Form }}
{{ $user := .User }}
<div class="ui form segment">
<form action="/users/{{ .Form.User.ID }}/" method="post">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<div class="ui form{{ if .Form.FieldErrors }} error{{ end }}">
<div class="required field{{ if .Form.FieldErrors.name }} error{{ end }}">
<label for="name">Name</label>
<input id="name" type="text" name="name" value="{{ .Form.Name }}">
{{ if .Form.FieldErrors.name }}
<span class="ui small error text">{{ .Form.FieldErrors.name }}</span>
{{ end }}
</div>
<div class="grouped fields{{ if .Form.FieldErrors.reminder_mail }} error{{ end }}">
<label>Reminder email address</label>
<table class="ui very basic collapsing table">
<tbody>
{{ range .Form.MailAddresses }}
<tr>
<td>
<div class="field">
<div class="ui radio checkbox">
<input id="mail-{{ . }}" type="radio" name="reminder_mail"
value="{{ . }}"{{ if eq $form.ReminderMail . }} checked{{ end }}>
<label for="mail-{{ . }}">{{ . }}</label>
</div>
</div>
</td>
<td>
{{ if not (eq $form.ReminderMail .) }} <a
class="ui small negative icon button"
href="/users/{{ $form.User.ID }}/mail/{{ . }}/delete"><i
class="icon delete" title="Delete email address {{ . }}"></i></a>{{ end }}
</td>
</tr>
{{ end }}
</tbody>
</table>
{{ if .Form.FieldErrors.reminder_mail }}
<span class="ui small error text">{{ .Form.FieldErrors.reminder_mail }}</span>
{{ end }}
<a class="ui small positive icon button" href="/users/{{ $form.User.ID }}/add-mail"><i
class="add icon"></i> Add new email address</a>
</div>
<div class="inline fields{{ if .Form.FieldErrors.roles }} error{{ end }}">
<label>Roles</label>
{{ range .Form.AllRoles }}
{{ $currentRole := . }}
<div class="field">
<div class="ui checkbox">
<input id="role-{{ . }}" aria-labelledby="role-label-{{ . }}" type="checkbox"
name="roles"
value="{{ .Name }}"{{ range $form.Roles }}{{ if eq $currentRole.Name . }} checked{{ end }}{{ end }}>
<label for="role-{{ . }}" id="role-label-{{ . }}">{{ . }}</label>
</div>
</div>
{{ end }}
{{ if .Form.FieldErrors.roles }}
<span class="ui small error text">{{ .Form.FieldErrors.roles }}</span>
{{ end }}
</div>
<div class="required field{{ if .Form.FieldErrors.reasoning }} error{{ end }}">
<label for="reasoning">Reasoning for the change</label>
<textarea id="reasoning" name="reasoning" rows="2">{{ .Form.Reasoning }}</textarea>
{{ if .Form.FieldErrors.reasoning }}
<span class="ui small error text">{{ .Form.FieldErrors.reasoning }}</span>
{{ end }}
</div>
<button class="ui primary labeled icon button" type="submit">
<i class="edit icon"></i> Edit user
2022-06-02 21:14:38 +00:00
</button>
<a href="/users/" class="ui button">Cancel</a>
</div>
</form>
</div>
{{ end }}