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

74 lines
2.9 KiB
Cheetah
Raw Permalink Normal View History

2022-05-11 21:38:20 +02:00
{{define "title"}}Configuration - Administration - Arcad{{end}}
{{define "body"}}
2022-06-01 17:31:21 +02:00
{{- block "head_style" . -}}
<link rel="stylesheet" href="/css/admin_settings.css">
{{end}}
2022-05-11 21:38:20 +02:00
{{template "header" .}}
2022-06-01 17:31:21 +02:00
<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>
2022-05-11 21:38:20 +02:00
</div>
</div>
</section>
{{end}}
{{define "body_script"}}
<script defer src="/admin.js"></script>
{{end}}
{{template "base" .}}
{{define "password_setting"}}
2022-06-01 17:31:21 +02:00
<div>
<label for="password" class="block text-gray-700 text-lg font-bold mb-2">{{ .Meta.Label }}</label>
2022-05-11 21:38:20 +02:00
<div class="control">
2022-06-01 17:31:21 +02:00
<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 }}"
2022-05-11 21:38:20 +02:00
autocomplete="new-password"
2022-06-01 17:31:21 +02:00
type="password"
id="password">
2022-05-11 21:38:20 +02:00
</div>
</div>
2022-06-01 17:31:21 +02:00
<div>
<label for="confirmPassword" class="block text-gray-700 text-lg font-bold mb-2">{{ .Meta.Label }} (confirmation)</label>
2022-05-11 21:38:20 +02:00
<div class="control">
2022-06-01 17:31:21 +02:00
<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"
2022-05-11 21:38:20 +02:00
autocomplete="new-password"
2022-06-01 17:31:21 +02:00
type="password"
id="confirmPassword">
2022-05-11 21:38:20 +02:00
</div>
</div>
{{end}}
{{define "markdown_setting"}}
2022-06-01 17:31:21 +02:00
<div>
<label for="homeMessage" class="block text-gray-700 text-lg font-bold mb-2">{{ .Meta.Label }}</label>
<div>
2022-05-11 21:38:20 +02:00
<div class="control">
2022-06-01 17:31:21 +02:00
<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>
2022-05-11 21:38:20 +02:00
</div>
</div>
</div>
{{end}}