From cb545173a6f33aff050a1855dcb87184d50b79a6 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Tue, 20 Sep 2016 00:24:31 -0700 Subject: adding support for boltdb storage, updating and inserting content, some reorganization --- content/post.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'content/post.go') diff --git a/content/post.go b/content/post.go index 1dfb8fb..7bb36f6 100644 --- a/content/post.go +++ b/content/post.go @@ -18,7 +18,7 @@ type Post struct { } func init() { - Types["Post"] = &Post{} + Types["Post"] = func() interface{} { return new(Post) } } // ContentID partially implements editor.Editable @@ -28,30 +28,30 @@ func (p *Post) ContentID() int { return p.ID } 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.New(&p, +func (p *Post) MarshalEditor() ([]byte, error) { + view, err := editor.New(p, editor.Field{ - View: editor.Input("Title", &p, map[string]string{ + View: editor.Input("Title", p, map[string]string{ "label": "Post Title", "type": "text", "placeholder": "Enter your Post Title here", }), }, editor.Field{ - View: editor.Textarea("Content", &p, map[string]string{ + View: editor.Textarea("Content", p, map[string]string{ "label": "Content", "placeholder": "Add the content of your post here", }), }, editor.Field{ - View: editor.Input("Author", &p, map[string]string{ + View: editor.Input("Author", p, map[string]string{ "label": "Author", "type": "text", "placeholder": "Enter the author name here", }), }, editor.Field{ - View: editor.Input("Timestamp", &p, map[string]string{ + View: editor.Input("Timestamp", p, map[string]string{ "label": "Publish Date", "type": "date", }), -- cgit v1.2.3