diff options
Diffstat (limited to 'cmd/ponzu/options.go')
-rw-r--r-- | cmd/ponzu/options.go | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/cmd/ponzu/options.go b/cmd/ponzu/options.go index 6f42f0c..b23ab2d 100644 --- a/cmd/ponzu/options.go +++ b/cmd/ponzu/options.go @@ -75,30 +75,11 @@ 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"` + "`" + ` } -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 { |