filebrowser/templates/frontmatter.tmpl

24 lines
1.6 KiB
Cheetah
Raw Normal View History

2015-09-19 21:17:38 +00:00
{{ define "frontmatter" }} {{ range $key, $value := . }} {{ if or (eq $value.Type "object") (eq $value.Type "array") }}
2015-09-20 12:04:33 +00:00
<fieldset id="{{ $value.Name }}" data-type="{{ $value.Type }}">
2015-09-20 08:15:21 +00:00
<h3>{{ SplitCapitalize $value.Title }}
2015-09-19 21:17:38 +00:00
<span class="actions">
<button class="add"><i class="fa fa-plus"></i></button>
2015-09-20 12:04:33 +00:00
<button class="delete"><i class="fa fa-minus"></i></button>
2015-09-19 21:17:38 +00:00
</span>
</h3>
{{ template "frontmatter" $value.Content }}
</fieldset>
{{ else }} {{ if not (eq $value.Parent.Type "array") }}
2015-09-20 08:15:21 +00:00
<label for="{{ $value.Name }}">{{ SplitCapitalize $value.Title }}
2015-09-19 21:17:38 +00:00
<span class="actions">
<button class="delete"><i class="fa fa-minus"></i></button>
</span>
</label>
2015-09-14 13:00:12 +00:00
{{ end }}
2015-09-20 12:28:47 +00:00
{{ if eq $value.Parent.Type "array" }}<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">{{ end }}
2015-10-24 09:54:10 +00:00
{{ 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 }}
2015-09-20 12:28:47 +00:00
{{ 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 }}