filebrowser/templates/frontmatter.tmpl
2015-09-20 13:28:47 +01:00

22 lines
1.1 KiB
Cheetah

{{ define "frontmatter" }} {{ range $key, $value := . }} {{ if or (eq $value.Type "object") (eq $value.Type "array") }}
<fieldset id="{{ $value.Name }}" data-type="{{ $value.Type }}">
<h3>{{ SplitCapitalize $value.Title }}
<span class="actions">
<button class="add"><i class="fa fa-plus"></i></button>
<button class="delete"><i class="fa fa-minus"></i></button>
</span>
</h3>
{{ template "frontmatter" $value.Content }}
</fieldset>
{{ else }} {{ if not (eq $value.Parent.Type "array") }}
<label for="{{ $value.Name }}">{{ SplitCapitalize $value.Title }}
<span class="actions">
<button class="delete"><i class="fa fa-minus"></i></button>
</span>
</label>
{{ end }}
{{ if eq $value.Parent.Type "array" }}<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">{{ end }}
<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" data-parent-type="{{ $value.Parent.Type }}"></input>
{{ if eq $value.Parent.Type "array" }}
<div class="actions"><button class="delete"><i class="fa fa-minus"></i></button></div></div>{{ end }} {{ end }} {{ end }} {{ end }}