filebrowser/assets/templates/frontmatter.tmpl

61 lines
1.9 KiB
Cheetah
Raw Normal View History

2016-06-23 22:21:44 +00:00
{{ define "blocks" }}
2016-06-28 09:01:00 +00:00
{{ if .Fields }}
<div class="group">
{{ end }}
{{ range $key, $value := .Fields }}
{{ if eq $value.Parent.Type "array" }}
<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">
{{ template "value" $value }}
<div class="action delete" data-delete="{{ $value.Name }}-{{ $key }}">
<i class="material-icons">close</i>
</div>
</div>
{{ else }}
<div class="block" id="block-{{ $value.Name }}" data-content="{{ $value.Name }}">
<label for="{{ $value.Name }}">{{ SplitCapitalize $value.Title }}</label>
{{ template "value" $value }}
<div class="action delete" data-delete="block-{{ $value.Name }}">
<i class="material-icons">close</i>
</div>
</div>
{{ end }}
{{ end }}
{{ if .Fields }}
</div>
{{ end }}
2016-06-26 22:03:27 +00:00
2016-06-28 09:01:00 +00:00
{{ range $key, $value := .Arrays }}
{{ template "fielset" $value }}
{{ end }}
2016-06-26 22:03:27 +00:00
2016-06-28 09:01:00 +00:00
{{ range $key, $value := .Objects }}
{{ template "fielset" $value }}
{{ end }}
2016-06-27 12:22:07 +00:00
2016-06-26 22:03:27 +00:00
{{ end }}
2016-06-23 22:21:44 +00:00
2016-06-26 22:03:27 +00:00
{{ define "value" }}
2016-06-28 09:01:00 +00:00
{{ if eq .HTMLType "textarea" }}
<textarea class="scroll" name="{{ .Name }}" id="{{.Name }}" data-parent-type="{{ .Parent.Type }}">{{ .Content.Other }}</textarea>
{{ else if eq .HTMLType "datetime" }}
2016-06-28 16:11:48 +00:00
<input name="{{ .Name }}" id="{{ .Name }}" value="{{ .Content.Other.Format "2006-01-02T15:04" }}" type="datetime-local" data-parent-type="{{ .Parent.Type }}"></input>
2016-06-28 09:01:00 +00:00
{{ else }}
<input name="{{ .Name }}" id="{{ .Name }}" value="{{ .Content.Other }}" type="{{ .HTMLType }}" data-parent-type="{{ .Parent.Type }}"></input>
{{ end }}
2016-06-26 22:03:27 +00:00
{{ end }}
2016-06-23 22:21:44 +00:00
2016-06-26 22:03:27 +00:00
{{ define "fielset" }}
2016-06-28 09:01:00 +00:00
<fieldset id="{{ .Name }}" data-type="{{ .Type }}">
{{ if not (eq .Title "") }}
<h3>{{ SplitCapitalize .Title }}</h3>
{{ end }}
2016-06-26 22:03:27 +00:00
<div class="action add">
2016-06-28 09:01:00 +00:00
<i class="material-icons">add</i>
2016-06-26 22:03:27 +00:00
</div>
2016-06-27 12:22:07 +00:00
<div class="action delete" data-delete="{{ .Name }}">
2016-06-28 09:01:00 +00:00
<i class="material-icons">close</i>
2016-06-26 22:03:27 +00:00
</div>
2016-06-28 09:01:00 +00:00
{{ template "blocks" .Content }}
</fieldset>
2016-06-23 22:21:44 +00:00
{{ end }}