2016-02-01 06:14:17 +08:00
|
|
|
{{ 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 }}</h3>
|
2015-09-20 05:17:38 +08:00
|
|
|
<span class="actions">
|
2016-02-01 06:14:17 +08:00
|
|
|
<button class="add">+</button>
|
|
|
|
<button class="delete">−</button>
|
2015-09-20 05:17:38 +08:00
|
|
|
</span>
|
2016-02-01 06:14:17 +08:00
|
|
|
{{ template "frontmatter" $value.Content }}
|
|
|
|
</fieldset>
|
|
|
|
{{ else }}
|
|
|
|
|
|
|
|
{{ if not (eq $value.Parent.Type "array") }}
|
|
|
|
<div class="block" id="block-{{ $value.Name }}" data-content="{{ $value.Name }}">
|
|
|
|
<label for="{{ $value.Name }}">{{ SplitCapitalize $value.Title }}</label>
|
|
|
|
<span class="actions">
|
|
|
|
<button class="delete">−</button>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
{{ 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" }}
|
2016-03-12 18:23:30 +08:00
|
|
|
<input name="{{ $value.Name }}:{{ $value.Type }}" id="{{ $value.Name }}" value="{{ $value.Content.Format "2006-01-02T15:04" }}" type="datetime-local" data-parent-type="{{ $value.Parent.Type }}"></input>
|
2016-02-01 06:14:17 +08:00
|
|
|
{{ 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 not (eq $value.Parent.Type "array") }}</div>{{ end }}
|
|
|
|
|
|
|
|
{{ if eq $value.Parent.Type "array" }}
|
|
|
|
<span class="actions"><button class="delete">−</button></span></div>
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2015-09-14 21:00:12 +08:00
|
|
|
{{ end }}
|