From 3dbc41fbbe547092604b51c6f26261dce05eab26 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Wed, 26 Oct 2016 00:44:43 -0700 Subject: changing arrangement of default and generated post / content type --- cmd/ponzu/options.go | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'cmd') diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go index 6f42f0c..468a447 100644 --- a/cmd/ponzu/options.go +++ b/cmd/ponzu/options.go @@ -80,25 +80,6 @@ type {{ .name }} struct { Theme string ` + "`json:" + `"theme"` + "`" + ` } -func init() { - Types["{{ .name }}"] = func() interface{} { return new({{ .name }}) } -} - -// SetContentID partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) SetContentID(id int) { {{ .initial }}.ID = id } - -// ContentID partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) ContentID() int { return {{ .initial }}.ID } - -// ContentName partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) ContentName() string { return {{ .initial }}.Title } - -// SetSlug partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) SetSlug(slug string) { {{ .initial }}.Slug = slug } - -// Editor partially implements editor.Editable -func ({{ .initial }} *{{ .name }}) Editor() *editor.Editor { return &{{ .initial }}.editor } - // MarshalEditor writes a buffer of html to edit a {{ .name }} and partially implements editor.Editable func ({{ .initial }} *{{ .name }}) MarshalEditor() ([]byte, error) { view, err := editor.Form({{ .initial }}, @@ -152,6 +133,26 @@ func ({{ .initial }} *{{ .name }}) MarshalEditor() ([]byte, error) { return view, nil } + +func init() { + Types["{{ .name }}"] = func() interface{} { return new({{ .name }}) } +} + +// SetContentID partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) SetContentID(id int) { {{ .initial }}.ID = id } + +// ContentID partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) ContentID() int { return {{ .initial }}.ID } + +// ContentName partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) ContentName() string { return {{ .initial }}.Title } + +// SetSlug partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) SetSlug(slug string) { {{ .initial }}.Slug = slug } + +// Editor partially implements editor.Editable +func ({{ .initial }} *{{ .name }}) Editor() *editor.Editor { return &{{ .initial }}.editor } + ` func newProjectInDir(path string) error { -- cgit v1.2.3 From c178f2e403b0b711d8aa3c0155d1368827f88afd Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Fri, 28 Oct 2016 12:58:25 -0700 Subject: adding some clean up code and UI toggle for future external vs. internal posted content --- cmd/ponzu/main.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmd') diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index 48aef9e..234d3b6 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -11,6 +11,7 @@ import ( "github.com/bosssauce/ponzu/system/admin" "github.com/bosssauce/ponzu/system/api" + "github.com/bosssauce/ponzu/system/api/analytics" "github.com/bosssauce/ponzu/system/db" "github.com/bosssauce/ponzu/system/tls" ) @@ -169,6 +170,11 @@ func main() { case "serve", "s": db.Init() + defer db.Close() + + analytics.Init() + defer analytics.Close() + if len(args) > 1 { services := strings.Split(args[1], ",") -- cgit v1.2.3 From 3e19599392728af12f762dff2d969c8190fd8fec Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Fri, 28 Oct 2016 17:11:35 -0700 Subject: debugging --- cmd/ponzu/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index 234d3b6..cbd501f 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -11,7 +11,6 @@ import ( "github.com/bosssauce/ponzu/system/admin" "github.com/bosssauce/ponzu/system/api" - "github.com/bosssauce/ponzu/system/api/analytics" "github.com/bosssauce/ponzu/system/db" "github.com/bosssauce/ponzu/system/tls" ) @@ -172,8 +171,8 @@ func main() { db.Init() defer db.Close() - analytics.Init() - defer analytics.Close() + // analytics.Init() + // defer analytics.Close() if len(args) > 1 { services := strings.Split(args[1], ",") -- cgit v1.2.3 From 30ea59f0d1cae4229490596efba22f9d9b298f4c Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Fri, 28 Oct 2016 17:12:38 -0700 Subject: debugging --- cmd/ponzu/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index cbd501f..2552256 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -169,7 +169,7 @@ func main() { case "serve", "s": db.Init() - defer db.Close() + // defer db.Close() // analytics.Init() // defer analytics.Close() -- cgit v1.2.3 From b6eb040045fcfeb39dda4fcd440d2be184c8e715 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sat, 29 Oct 2016 01:33:33 -0700 Subject: adding db/analytics init back in after reverting for debug --- cmd/ponzu/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/ponzu/main.go b/cmd/ponzu/main.go index 2552256..234d3b6 100644 --- a/cmd/ponzu/main.go +++ b/cmd/ponzu/main.go @@ -11,6 +11,7 @@ import ( "github.com/bosssauce/ponzu/system/admin" "github.com/bosssauce/ponzu/system/api" + "github.com/bosssauce/ponzu/system/api/analytics" "github.com/bosssauce/ponzu/system/db" "github.com/bosssauce/ponzu/system/tls" ) @@ -169,10 +170,10 @@ func main() { case "serve", "s": db.Init() - // defer db.Close() + defer db.Close() - // analytics.Init() - // defer analytics.Close() + analytics.Init() + defer analytics.Close() if len(args) > 1 { services := strings.Split(args[1], ",") -- cgit v1.2.3 From 07f7c974724d1ab1f86131d2a75cff3f52ace5c4 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Sun, 30 Oct 2016 22:35:03 -0700 Subject: sync example content type fields --- cmd/ponzu/options.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go index 468a447..b23ab2d 100644 --- a/cmd/ponzu/options.go +++ b/cmd/ponzu/options.go @@ -75,7 +75,7 @@ type {{ .name }} struct { Title string ` + "`json:" + `"title"` + "`" + ` Content string ` + "`json:" + `"content"` + "`" + ` Author string ` + "`json:" + `"author"` + "`" + ` - Photo string ` + "`json:" + `"picture"` + "`" + ` + Photo string ` + "`json:" + `"photo"` + "`" + ` Category []string ` + "`json:" + `"category"` + "`" + ` Theme string ` + "`json:" + `"theme"` + "`" + ` } -- cgit v1.2.3