summaryrefslogtreecommitdiff
path: root/examples/updateable/content/song.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-03-15 13:24:25 -0700
committerSteve Manuel <nilslice@gmail.com>2017-03-15 13:24:25 -0700
commit95c7e73e2b8acf048ba61b3feab76dd5f46ac955 (patch)
tree54b025fc6ae9eb7d1adea71f33ec6d05ae50b3db /examples/updateable/content/song.go
parent40a7be1cb8218e705d77965f61c2c948e23971b9 (diff)
adding deleteable example, rename and modify externalable -> createable
Diffstat (limited to 'examples/updateable/content/song.go')
-rw-r--r--examples/updateable/content/song.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/updateable/content/song.go b/examples/updateable/content/song.go
index 1ebe232..947821c 100644
--- a/examples/updateable/content/song.go
+++ b/examples/updateable/content/song.go
@@ -79,10 +79,10 @@ func init() {
// String defines the display name of a Song in the CMS list-view
func (s *Song) String() string { return s.Title }
-// BeforeAcceptUpdate is only called if the Song type implements api.Updateable
-// It is called before AcceptUpdate, and returning an error will cancel the request
+// BeforeAPIUpdate is only called if the Song type implements api.Updateable
+// It is called before Update, and returning an error will cancel the request
// causing the system to reject the data sent in the POST
-func (s *Song) BeforeAcceptUpdate(res http.ResponseWriter, req *http.Request) error {
+func (s *Song) BeforeAPIUpdate(res http.ResponseWriter, req *http.Request) error {
// do initial user authentication here on the request, checking for a
// token or cookie, or that certain form fields are set and valid
@@ -94,16 +94,16 @@ func (s *Song) BeforeAcceptUpdate(res http.ResponseWriter, req *http.Request) er
}
// you could then to data validation on the request post form, or do it in
- // the Accept method, which is called after BeforeAccept
+ // the Update method, which is called after BeforeAPIUpdate
return nil
}
-// AcceptUpdate is called after BeforeAccept and is where you may influence the
+// Update is called after BeforeAPIUpdate and is where you may influence the
// merge process. For example, maybe you don't want an empty string for the Title
// or Artist field to be accepted by the update request. Updates will always merge
// with existing values, but by default will accept zero value as an update if sent.
-func (s *Song) AcceptUpdate(res http.ResponseWriter, req *http.Request) error {
+func (s *Song) Update(res http.ResponseWriter, req *http.Request) error {
addr := req.RemoteAddr
log.Println("Song update sent by:", addr, "id:", req.URL.Query().Get("id"))
@@ -129,11 +129,11 @@ func (s *Song) AcceptUpdate(res http.ResponseWriter, req *http.Request) error {
return nil
}
-// AfterAcceptUpdate is called after AcceptUpdate, and is useful for logging or triggering
+// AfterAPIUpdate is called after Update, and is useful for logging or triggering
// notifications, etc. after the data is saved to the database, etc.
// The request has a context containing the databse 'target' affected by the
// request.
-func (s *Song) AfterAcceptUpdate(res http.ResponseWriter, req *http.Request) error {
+func (s *Song) AfterAPIUpdate(res http.ResponseWriter, req *http.Request) error {
addr := req.RemoteAddr
log.Println("Song updated by:", addr, "id:", req.URL.Query().Get("id"))