filebrowser/templates/frontmatter.tmpl

24 lines
1.6 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 }}
{{ if eq $value.HTMLType "textarea" }}<textarea class="scroll" name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" data-parent-type="{{ $value.Parent.Type }}">{{ $value.Content }}</textarea>
{{ else if eq $value.HTMLType "datetime" }}<input class="datetimepicker" name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" type="text" data-parent-type="{{ $value.Parent.Type }}"></input>
{{ else }}<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content }}" type="{{ $value.HTMLType }}" data-parent-type="{{ $value.Parent.Type }}"></input>{{ end }}
{{ 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 }}