Created
November 8, 2011 02:10
-
-
Save billeisenhauer/1346812 to your computer and use it in GitHub Desktop.
Backbone Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TRIPCASE.controllers.Feedback = TRIPCASE.Controller.extend({ | |
init: function(options) { | |
_.bindAll(this, "_onCreate"); | |
}, | |
/* Actions */ | |
feedback: function() { | |
var feedback = new TRIPCASE.models.Feedback(); | |
var view = new TRIPCASE.views.NewFeedbackView({model: feedback}); | |
view.bind("feedback:create", this._onCreate); | |
view.bind("screen:back", this.sm.pop); | |
this.sm.push(view); | |
}, | |
/* Event Responders */ | |
_onCreate: function(feedback) { | |
var self = this; | |
_gaq.push(['_trackEvent', 'User', 'Feedback']); | |
feedback.save(feedback, { | |
success: function(model, data) { | |
self.ui.showNotice('Your feedback has been sent!'); | |
self.sm.pop(); | |
} | |
}); | |
} | |
}); | |
var feedbackController = new TRIPCASE.controllers.Feedback(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment