summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-10-25 11:46:04 -0700
committerSteve Manuel <nilslice@gmail.com>2016-10-25 11:46:04 -0700
commit48de0f15a493d104501b055a0b7aa88fff101b19 (patch)
tree4ce70961c292619c9fe0251ca9a921453b12f6aa
parent09b06ed0e0188b8559620e4e0c4f7e54599044af (diff)
updating content type generator template and modifying default post
-rw-r--r--cmd/ponzu/options.go23
-rw-r--r--content/post.go16
2 files changed, 17 insertions, 22 deletions
diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go
index cabe91a..6f42f0c 100644
--- a/cmd/ponzu/options.go
+++ b/cmd/ponzu/options.go
@@ -72,12 +72,12 @@ type {{ .name }} struct {
editor editor.Editor
// required: all maintained {{ .name }} fields must have json tags!
- Title string ` + "`json:" + `"title"` + "`" + `
- Content string ` + "`json:" + `"content"` + "`" + `
- Author string ` + "`json:" + `"author"` + "`" + `
- Picture string ` + "`json:" + `"picture"` + "`" + `
- Category []string ` + "`json:" + `"category"` + "`" + `
- ThemeStyle string ` + "`json:" + `"theme"` + "`" + `
+ Title string ` + "`json:" + `"title"` + "`" + `
+ Content string ` + "`json:" + `"content"` + "`" + `
+ Author string ` + "`json:" + `"author"` + "`" + `
+ Photo string ` + "`json:" + `"picture"` + "`" + `
+ Category []string ` + "`json:" + `"category"` + "`" + `
+ Theme string ` + "`json:" + `"theme"` + "`" + `
}
func init() {
@@ -101,7 +101,6 @@ func ({{ .initial }} *{{ .name }}) Editor() *editor.Editor { return &{{ .initial
// MarshalEditor writes a buffer of html to edit a {{ .name }} and partially implements editor.Editable
func ({{ .initial }} *{{ .name }}) MarshalEditor() ([]byte, error) {
-/* EXAMPLE CODE (from post.go, the default content type) */
view, err := editor.Form({{ .initial }},
editor.Field{
// Take careful note that the first argument to these Input-like methods
@@ -127,22 +126,18 @@ func ({{ .initial }} *{{ .name }}) MarshalEditor() ([]byte, error) {
}),
},
editor.Field{
- View: editor.File("Picture", {{ .initial }}, map[string]string{
+ View: editor.File("Photo", {{ .initial }}, map[string]string{
"label": "Author Photo",
"placeholder": "Upload a profile picture for the author",
}),
},
editor.Field{
- View: editor.Checkbox("Category", {{ .initial }}, map[string]string{
+ View: editor.Tags("Category", {{ .initial }}, map[string]string{
"label": "{{ .name }} Category",
- }, map[string]string{
- "important": "Important",
- "active": "Active",
- "unplanned": "Unplanned",
}),
},
editor.Field{
- View: editor.Select("ThemeStyle", {{ .initial }}, map[string]string{
+ View: editor.Select("Theme", {{ .initial }}, map[string]string{
"label": "Theme Style",
}, map[string]string{
"dark": "Dark",
diff --git a/content/post.go b/content/post.go
index 08b831d..d121ed7 100644
--- a/content/post.go
+++ b/content/post.go
@@ -11,12 +11,12 @@ type Post struct {
Item
editor editor.Editor
- Title string `json:"title"`
- Content string `json:"content"`
- Photo string `json:"photo"`
- Author string `json:"author"`
- Category []string `json:"category"`
- ThemeStyle string `json:"theme"`
+ Title string `json:"title"`
+ Content string `json:"content"`
+ Photo string `json:"photo"`
+ Author string `json:"author"`
+ Category []string `json:"category"`
+ Theme string `json:"theme"`
}
func init() {
@@ -55,7 +55,7 @@ func (p *Post) MarshalEditor() ([]byte, error) {
}),
},
editor.Field{
- View: editor.File("Picture", p, map[string]string{
+ View: editor.File("Photo", p, map[string]string{
"label": "Author Photo",
"placeholder": "Upload a profile picture for the author",
}),
@@ -73,7 +73,7 @@ func (p *Post) MarshalEditor() ([]byte, error) {
}),
},
editor.Field{
- View: editor.Select("ThemeStyle", p, map[string]string{
+ View: editor.Select("Theme", p, map[string]string{
"label": "Theme Style",
}, map[string]string{
"dark": "Dark",