summaryrefslogtreecommitdiff
path: root/content/post.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-10-31 01:06:36 -0700
committerSteve Manuel <nilslice@gmail.com>2016-10-31 01:06:36 -0700
commit76f1af6aad8de62f3df540767e713959c3385c01 (patch)
tree5cb9c7184b94be344492d8fd89c7709a14ccaee9 /content/post.go
parent519c5b44d0b36e1f61cb0228889401fa1e33357e (diff)
parent12cd2d10d79b7b8f0666c7f3f145e773f6edaac5 (diff)
Merge branch 'ponzu-dev'
Diffstat (limited to 'content/post.go')
-rw-r--r--content/post.go62
1 files changed, 29 insertions, 33 deletions
diff --git a/content/post.go b/content/post.go
index 7dc99c1..dcdfeff 100644
--- a/content/post.go
+++ b/content/post.go
@@ -11,33 +11,14 @@ 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() {
- Types["Post"] = func() interface{} { return new(Post) }
-}
-
-// SetContentID partially implements editor.Editable
-func (p *Post) SetContentID(id int) { p.ID = id }
-
-// ContentID partially implements editor.Editable
-func (p *Post) ContentID() int { return p.ID }
-
-// ContentName partially implements editor.Editable
-func (p *Post) ContentName() string { return p.Title }
-
-// SetSlug partially implements editor.Editable
-func (p *Post) SetSlug(slug string) { p.Slug = slug }
-
-// Editor partially implements editor.Editable
-func (p *Post) Editor() *editor.Editor { return &p.editor }
-
// MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable
func (p *Post) MarshalEditor() ([]byte, error) {
view, err := editor.Form(p,
@@ -55,7 +36,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",
}),
@@ -68,16 +49,12 @@ func (p *Post) MarshalEditor() ([]byte, error) {
}),
},
editor.Field{
- View: editor.Checkbox("Category", p, map[string]string{
- "label": "Post Category",
- }, map[string]string{
- "important": "Important",
- "active": "Active",
- "unplanned": "Unplanned",
+ View: editor.Tags("Category", p, map[string]string{
+ "label": "Post Categories",
}),
},
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",
@@ -92,3 +69,22 @@ func (p *Post) MarshalEditor() ([]byte, error) {
return view, nil
}
+
+func init() {
+ Types["Post"] = func() interface{} { return new(Post) }
+}
+
+// SetContentID partially implements editor.Editable
+func (p *Post) SetContentID(id int) { p.ID = id }
+
+// ContentID partially implements editor.Editable
+func (p *Post) ContentID() int { return p.ID }
+
+// ContentName partially implements editor.Editable
+func (p *Post) ContentName() string { return p.Title }
+
+// SetSlug partially implements editor.Editable
+func (p *Post) SetSlug(slug string) { p.Slug = slug }
+
+// Editor partially implements editor.Editable
+func (p *Post) Editor() *editor.Editor { return &p.editor }