func (s *Song) Approve(res http.ResponseWriter, req *http.Request) error {
	return nil
}
Approve implements editor.Mergeable, which enables content supplied by external
clients to be approved and thus added to the public content API. Before content
is approved, it is waiting in the Pending bucket, and can only be approved in
the CMS if the Mergeable interface is satisfied. If not, you will not see this
content show up in the CMS.
package content
import (
	"fmt"
	"log"
	"net/http"
	"github.com/ponzu-cms/ponzu/management/editor"
	"github.com/ponzu-cms/ponzu/system/admin/user"
	"github.com/ponzu-cms/ponzu/system/api"
	"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"`
}
func (s *Song) MarshalEditor() ([]byte, error) {
	view, err := editor.Form(s,
		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.Richtext("Opinion", s, map[string]string{
				"label":       "Opinion",
				"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) }
}
func (s *Song) String() string { return s.Title }
func (s *Song) Create(res http.ResponseWriter, req *http.Request) error {
	required := []string{
		"title",
		"artist",
		"rating",
		"opinion",
		"spotify_url",
	}
	for _, r := range required {
		if req.PostFormValue(r) == "" {
			err := fmt.Errorf("request missing required field: %s", r)
			return err
		}
	}
	return nil
}
func (s *Song) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error {
	if !user.IsValid(req) {
		return api.ErrNoAuth
	}
	return nil
}
func (s *Song) AfterAPICreate(res http.ResponseWriter, req *http.Request) error {
	addr := req.RemoteAddr
	log.Println("Song sent by:", addr, "titled:", req.PostFormValue("title"))
	return nil
}