diff options
author | Steve <nilslice@gmail.com> | 2016-10-31 00:59:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-31 00:59:57 -0700 |
commit | 645cfa39a92a9f732629f1e3206ca468ff329138 (patch) | |
tree | 89fc417b79394fb4fc58de997194b9730acfefc1 /cmd/ponzu/options.go | |
parent | 96ebcb095797fe4947d647ad1aa7572d84609fc0 (diff) | |
parent | 682cc2b6d9e3524209fbe3d2773fa31e8de9b88d (diff) |
Merge pull request #11 from bosssauce/ponzu-dev
[core] Enable content to be submitted from external clients
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 { |