diff options
Diffstat (limited to 'examples/docker/admin/content/song.go')
-rw-r--r-- | examples/docker/admin/content/song.go | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/examples/docker/admin/content/song.go b/examples/docker/admin/content/song.go deleted file mode 100644 index fa5e802..0000000 --- a/examples/docker/admin/content/song.go +++ /dev/null @@ -1,73 +0,0 @@ -package content - -import ( - "fmt" - - "github.com/ponzu-cms/ponzu/management/editor" - "github.com/ponzu-cms/ponzu/system/item" -) - -type Song struct { - item.Item - - Title string `json:"title"` - Artist string `json:"artist"` - Rating int `json:"rating"` - Opinion string `json:"opinion"` - SpotifyUrl string `json:"spotify_url"` -} - -// MarshalEditor writes a buffer of html to edit a Song within the CMS -// and implements editor.Editable -func (s *Song) MarshalEditor() ([]byte, error) { - view, err := editor.Form(s, - // Take note that the first argument to these Input-like functions - // is the string version of each Song field, and must follow - // this pattern for auto-decoding and auto-encoding reasons: - editor.Field{ - View: editor.Input("Title", s, map[string]string{ - "label": "Title", - "type": "text", - "placeholder": "Enter the Title here", - }), - }, - editor.Field{ - View: editor.Input("Artist", s, map[string]string{ - "label": "Artist", - "type": "text", - "placeholder": "Enter the Artist here", - }), - }, - editor.Field{ - View: editor.Input("Rating", s, map[string]string{ - "label": "Rating", - "type": "text", - "placeholder": "Enter the Rating here", - }), - }, - editor.Field{ - View: editor.Input("Opinion", s, map[string]string{ - "label": "Opinion", - "type": "text", - "placeholder": "Enter the Opinion here", - }), - }, - editor.Field{ - View: editor.Input("SpotifyUrl", s, map[string]string{ - "label": "SpotifyUrl", - "type": "text", - "placeholder": "Enter the SpotifyUrl here", - }), - }, - ) - - if err != nil { - return nil, fmt.Errorf("Failed to render Song editor view: %s", err.Error()) - } - - return view, nil -} - -func init() { - item.Types["Song"] = func() interface{} { return new(Song) } -} |