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

74 lines
2.9 KiB
Cheetah

{{define "title"}}Configuration - Administration - Arcad{{end}}
{{define "body"}}
{{- block "head_style" . -}}
<link rel="stylesheet" href="/css/admin_settings.css">
{{end}}
{{template "header" .}}
<section class="block" data-controller="clock-sync">
<div class="mt-6">
{{template "admin_menu" "config"}}
</div>
<div class="content">
{{template "flash" .}}
<div class="mt-6">
<h4 class="text-xl text-center font-bold mb-8">Réglages</h4>
<form id="adminSettings" class="rounded-md shadow-xl shadow-cyan-800/50 p-8 block m-auto w-4/5" 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="block m-auto mt-8 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded" value="Enregistrer">
</p>
</div>
</form>
</div>
</div>
</section>
{{end}}
{{define "body_script"}}
<script defer src="/admin.js"></script>
{{end}}
{{template "base" .}}
{{define "password_setting"}}
<div>
<label for="password" class="block text-gray-700 text-lg font-bold mb-2">{{ .Meta.Label }}</label>
<div class="control">
<input class="shadow appearance-none border focus:border-cyan-600 rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline" name="{{ .ID }}"
autocomplete="new-password"
type="password"
id="password">
</div>
</div>
<div>
<label for="confirmPassword" class="block text-gray-700 text-lg font-bold mb-2">{{ .Meta.Label }} (confirmation)</label>
<div class="control">
<input class="shadow appearance-none border focus:border-cyan-600 rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline" name="{{ .ID }}-confirm"
autocomplete="new-password"
type="password"
id="confirmPassword">
</div>
</div>
{{end}}
{{define "markdown_setting"}}
<div>
<label for="homeMessage" class="block text-gray-700 text-lg font-bold mb-2">{{ .Meta.Label }}</label>
<div>
<div class="control">
<textarea id="homeMessage" class="focus:border-cyan-600 block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:outline-none" placeholder="{{ .Meta.DefaultValue }}" name="{{ .ID }}">{{- if .Setting}}{{ .Setting.Value }}{{end -}}</textarea>
</div>
</div>
</div>
{{end}}