filebrowser/_assets/_old/templates/frontmatter.tmpl
Henrique Dias 0a65393527 updates...
Former-commit-id: 2d19655aac80ec7033829b0b3d708bf86986252c [formerly b8bb006bd1a5492960c1d4793e15e80775ddc5fd] [formerly 4641277c14953bdb2ddab89ba866cf63f3dac0f9 [formerly 95b91a64a3]]
Former-commit-id: 5a6e07758bbe67fd202effa5b2975c65227eaebd [formerly 9a161548d270750b8da949189ad6f3b641779bfc]
Former-commit-id: 84e0bbcbbead53c5e91987574d5c854a9792515f
2017-06-28 11:45:41 +01:00

57 lines
2.0 KiB
Cheetah

{{ define "blocks" }}
{{ 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" title="Close">close</i>
</div>
</div>
{{- else }}
<div class="block" id="block-{{ $value.Name }}" data-content="{{ $value.Name }}">
<label for="{{ $value.Name }}">{{ $value.Title }}</label>
{{ template "value" $value }}
<div class="action delete" data-delete="block-{{ $value.Name }}">
<i class="material-icons" title="Close">close</i>
</div>
</div>
{{- end }}
{{- end }}
{{- if .Fields }}</div>{{ end }}
{{- range $key, $value := .Arrays }}
{{- template "fielset" $value }}
{{- end }}
{{- range $key, $value := .Objects }}
{{- template "fielset" $value }}
{{- end }}
{{ end }}
{{ define "value" }}
{{- if eq .HTMLType "textarea" }}
<textarea class="scroll" name="{{ .Name }}" id="{{.Name }}" data-parent-type="{{ .Parent.Type }}">{{ .Content.Other }}</textarea>
{{- else if eq .HTMLType "datetime" }}
<input name="{{ .Name }}" id="{{ .Name }}" value="{{ .Content.Other.Format "2006-01-02T15:04" }}" type="datetime-local" data-parent-type="{{ .Parent.Type }}"></input>
{{- else }}
<input name="{{ .Name }}" id="{{ .Name }}" value="{{ .Content.Other }}" type="{{ .HTMLType }}" data-parent-type="{{ .Parent.Type }}"></input>
{{- end }}
{{ end }}
{{ define "fielset" }}
<fieldset id="{{ .Name }}" data-type="{{ .Type }}">
{{- if not (eq .Title "") }}
<h3>{{ .Name }}</h3>
{{- end }}
<div class="action add">
<i class="material-icons" title="Add">add</i>
</div>
<div class="action delete" data-delete="{{ .Name }}">
<i class="material-icons" title="Close">close</i>
</div>
{{- template "blocks" .Content }}
</fieldset>
{{ end }}