cadoles-arcad/template/layouts/admin_settings.html.tmpl

71 lines
2.1 KiB
Cheetah

{{define "title"}}Configuration - Administration - Arcad{{end}}
{{define "body"}}
{{template "header" .}}
<section class="home is-fullheight section" data-controller="clock-sync">
<div class="container">
<div class="columns">
<div class="column is-2">
{{template "admin_menu" "config"}}
</div>
<div class="mt-2">
{{template "flash" .}}
<h4 class="is-size-4">Réglages</h4>
<form id="adminSettings" method="post">
{{ .csrfField }}
{{ $settings := .Settings }}
{{range $id, $meta := .Metadatas}}
{{ $se := $settings.Get $id }}
{{ $data := createMap "ID" $id "Setting" $se "Meta" $meta }}
{{if eq $meta.ValueType "password"}}
{{template "password_setting" $data}}
{{else if eq $meta.ValueType "markdown"}}
{{template "markdown_setting" $data}}
{{end}}
{{end}}
<div class="field is-grouped is-grouped-right">
<p class="control">
<input type="submit" class="button is-success" value="Enregistrer">
</p>
</div>
</form>
</div>
</div>
</div>
</section>
{{end}}
{{define "body_script"}}
<script defer src="/admin.js"></script>
{{end}}
{{template "base" .}}
{{define "password_setting"}}
<div class="field">
<label class="label">{{ .Meta.Label }}</label>
<div class="control">
<input class="input" name="{{ .ID }}"
autocomplete="new-password"
type="password">
</div>
</div>
<div class="field">
<label class="label">{{ .Meta.Label }} (confirmation)</label>
<div class="control">
<input class="input" name="{{ .ID }}-confirm"
autocomplete="new-password"
type="password">
</div>
</div>
{{end}}
{{define "markdown_setting"}}
<div class="field">
<label class="label">{{ .Meta.Label }}</label>
<div class="field">
<div class="control">
<textarea class="textarea" placeholder="{{ .Meta.DefaultValue }}" name="{{ .ID }}">{{- if .Setting}}{{ .Setting.Value }}{{end -}}</textarea>
</div>
</div>
</div>
{{end}}