This commit is contained in:
Henrique Dias
2015-09-14 10:46:31 +01:00
parent 788218e115
commit e9d507fec3
9 changed files with 173 additions and 90 deletions

View File

@@ -20,3 +20,9 @@
<header class="site-header">
Admin
</header>
{{ template "content" . }}
<footer></footer>
</body>
</html>

View File

@@ -1,4 +1,4 @@
{{#HEADER#}}
{{ define "content" }}
{{ with .Body }}
<div class="content">
@@ -13,4 +13,4 @@
</div>
{{ end }}
{{#FOOTER#}}
{{ end }}

View File

@@ -1,5 +0,0 @@
<footer>
</footer>
</body>
</html>

View File

@@ -1,4 +1,18 @@
{{#HEADER#}}
{{ define "optsLoop" }}
{{ range $key, $value := . }}
{{ if $value.SubContent }}
<h2>{{ splitCapitalize $value.Name }}</h2>
{{ template "optsLoop" $value.Content }}
{{ else}}
<label for="{{ $value.Master }}_{{ $value.Name }}">{{ splitCapitalize $value.Name }}</label>
<input name="{{ $value.Master }}_{{ $value.Name }}" id="{{ $value.Master }}_{{ $value.Name }}" value="{{ $value.Content }}"></input><br>
{{ end }}
{{ end }}
{{ end }}
{{ define "content" }}
{{ with .Body }}
<div class="content">
@@ -6,25 +20,11 @@
<h1>Settings</h1>
<form>
{{ range $key, $value := . }}
{{ if isMap $value }}
<h2>{{ splitCapitalize $key }}</h2>
<div id="{{ $key }}">
<!-- call this range again -->
</div>
{{ else }}
<label for="{{ $key }}">{{ splitCapitalize $key }}</label>
<input name="{{ $key }}" id="{{ $key }}" value="{{ $value }}"></input><br>
{{ end }}
{{ end }}
{{ template "optsLoop" .Settings }}
</form>
</div>
{{ end }}
{{#FOOTER#}}
{{ end }}