filebrowser/templates/editor.tmpl
2016-02-07 09:34:28 +00:00

58 lines
2.3 KiB
Cheetah

{{ define "content" }}
<div class="editor {{ .Class }} container">
{{ if eq .Class "complete" }}
<h1><textarea id="site-title">{{ .Name }}</textarea></h1>
{{ end }}
<form method="POST" action="">
<main>
{{ if not (eq .Class "complete") }}
<h1 id="site-title">{{ .Name }}</h1>
{{ end }}
{{ if eq .Class "frontmatter-only" }}
<div class="frontmatter blocks">
{{ template "frontmatter" .FrontMatter }}
<p class="actions">
<button class="add">Add field</button>
</p>
</div>
{{ else if eq .Class "content-only" }}
<div class="content">
<textarea id="editor-source" name="content" data-mode="{{ .Mode }}">{{ .Content }}</textarea>
</div>
{{ else }}
<div class="frontmatter">
<div class="blocks">
{{ template "frontmatter" .FrontMatter }}
</div>
<p class="actions">
<button class="add">Add field</button>
</p>
</div>
<div class="content">
{{ if eq .Mode "markdown" }}
<nav>
<a id="see-source"><i class="fa fa-code"></i> Source</a>
<a id="see-preview"><i class="fa fa-eye"></i> Preview</a>
</nav>
{{ end}}
<textarea id="editor-source" name="content" data-mode="{{ .Mode }}">{{ .Content }}</textarea>
<div id="editor-preview"></div>
</div>
{{ end }}
<p class="toolbar">
<input type="submit" data-type="{{ .Class }}" data-message="{{ if eq .Class "frontmatter-only" }}The fields were put on their way.{{ else if eq .Class "content-only" }}Every byte was saved.{{ else }}Post saved with pomp and circumstance.{{ end }}" data-regenerate="false" value="Save">
<span class="right">
{{ if and (eq .Class "complete") ( .IsPost ) }}<input type="submit" data-type="{{ .Class }}" data-message="Post scheduled." data-schedule="true" value="Schedule"> {{ end }}
<input type="submit" data-type="{{ .Class }}" data-message="{{ if eq .Class "frontmatter-only" }}Saved and regenerated.{{ else if eq .Class "content-only" }}Done. What do you want more?{{ else }}Post published. Go and share it!{{ end }}" data-regenerate="true" class="default" value="Publish">
</span>
</p>
</main>
</form>
</div>
{{ end }}