summaryrefslogtreecommitdiff
path: root/examples/docker/admin/cmd/ponzu/templates
diff options
context:
space:
mode:
authorkmeister <kris@aliencom.net>2017-04-13 12:02:14 -0400
committerkmeister <kris@aliencom.net>2017-04-13 12:06:49 -0400
commit9c58e5784758bd67bcedf0fcf62e8e59fda215a3 (patch)
treec512b0e7ec0a1012848817e5ee2387e5e8d98cd6 /examples/docker/admin/cmd/ponzu/templates
parent770cd49278c8917d6639de0ad178eb5d434778b7 (diff)
[docker example] default admin
Diffstat (limited to 'examples/docker/admin/cmd/ponzu/templates')
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-checkbox.tmpl5
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-content.tmpl39
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-custom.tmpl6
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-file.tmpl4
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-hidden.tmpl3
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-input.tmpl5
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-richtext.tmpl4
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-select.tmpl5
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-tags.tmpl4
-rw-r--r--examples/docker/admin/cmd/ponzu/templates/gen-textarea.tmpl4
10 files changed, 79 insertions, 0 deletions
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-checkbox.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-checkbox.tmpl
new file mode 100644
index 0000000..23713dc
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-checkbox.tmpl
@@ -0,0 +1,5 @@
+View: editor.Checkbox("{{ .Name }}", {{ .Initial }}, map[string]string{
+ "label": "{{ .Name }}",
+}, map[string]string{
+ // "value": "Display Name",
+}), \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-content.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-content.tmpl
new file mode 100644
index 0000000..2d92b88
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-content.tmpl
@@ -0,0 +1,39 @@
+package content
+
+import (
+ "fmt"
+
+ "github.com/ponzu-cms/ponzu/management/editor"
+ "github.com/ponzu-cms/ponzu/system/item"
+)
+
+type {{ .Name }} struct {
+ item.Item
+
+ {{ range .Fields }}{{ .Name }} {{ .TypeName }} `json:"{{ .JSONName }}"`
+ {{ end }}
+}
+
+// MarshalEditor writes a buffer of html to edit a {{ .Name }} within the CMS
+// and implements editor.Editable
+func ({{ .Initial }} *{{ .Name }}) MarshalEditor() ([]byte, error) {
+ view, err := editor.Form({{ .Initial }},
+ // Take note that the first argument to these Input-like functions
+ // is the string version of each {{ .Name }} field, and must follow
+ // this pattern for auto-decoding and auto-encoding reasons:
+ {{ range .Fields }}editor.Field{
+ {{ .View }}
+ },
+ {{ end }}
+ )
+
+ if err != nil {
+ return nil, fmt.Errorf("Failed to render {{ .Name }} editor view: %s", err.Error())
+ }
+
+ return view, nil
+}
+
+func init() {
+ item.Types["{{ .Name }}"] = func() interface{} { return new({{ .Name }}) }
+} \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-custom.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-custom.tmpl
new file mode 100644
index 0000000..6079f8b
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-custom.tmpl
@@ -0,0 +1,6 @@
+View: []byte(`
+ <div class="input-field col s12">
+ <label class="active">{{ .Name }}</label>
+ <!-- Add your custom editor field view here. -->
+ </div>
+ `), \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-file.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-file.tmpl
new file mode 100644
index 0000000..7bcaa4c
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-file.tmpl
@@ -0,0 +1,4 @@
+View: editor.File("{{ .Name }}", {{ .Initial }}, map[string]string{
+ "label": "{{ .Name }}",
+ "placeholder": "Upload the {{ .Name }} here",
+}), \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-hidden.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-hidden.tmpl
new file mode 100644
index 0000000..4b00456
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-hidden.tmpl
@@ -0,0 +1,3 @@
+View: editor.Input("{{ .Name }}", {{ .Initial }}, map[string]string{
+ "type": "hidden",
+}), \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-input.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-input.tmpl
new file mode 100644
index 0000000..8bea12a
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-input.tmpl
@@ -0,0 +1,5 @@
+View: editor.Input("{{ .Name }}", {{ .Initial }}, map[string]string{
+ "label": "{{ .Name }}",
+ "type": "text",
+ "placeholder": "Enter the {{ .Name }} here",
+}), \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-richtext.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-richtext.tmpl
new file mode 100644
index 0000000..c7ec18c
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-richtext.tmpl
@@ -0,0 +1,4 @@
+View: editor.Richtext("{{ .Name }}", {{ .Initial }}, map[string]string{
+ "label": "{{ .Name }}",
+ "placeholder": "Enter the {{ .Name }} here",
+}), \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-select.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-select.tmpl
new file mode 100644
index 0000000..509eb30
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-select.tmpl
@@ -0,0 +1,5 @@
+View: editor.Select("{{ .Name }}", {{ .Initial }}, map[string]string{
+ "label": "{{ .Name }}",
+}, map[string]string{
+ // "value": "Display Name",
+}), \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-tags.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-tags.tmpl
new file mode 100644
index 0000000..ca92c94
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-tags.tmpl
@@ -0,0 +1,4 @@
+View: editor.Tags("{{ .Name }}", {{ .Initial }}, map[string]string{
+ "label": "{{ .Name }}",
+ "placeholder": "+{{ .Name }}",
+}), \ No newline at end of file
diff --git a/examples/docker/admin/cmd/ponzu/templates/gen-textarea.tmpl b/examples/docker/admin/cmd/ponzu/templates/gen-textarea.tmpl
new file mode 100644
index 0000000..af3dad8
--- /dev/null
+++ b/examples/docker/admin/cmd/ponzu/templates/gen-textarea.tmpl
@@ -0,0 +1,4 @@
+View: editor.Textarea("{{ .Name }}", {{ .Initial }}, map[string]string{
+ "label": "{{ .Name }}",
+ "placeholder": "Enter the {{ .Name }} here",
+}), \ No newline at end of file