- tagName: 'div',\r
-\r
- events: {"click button.js-submit": "submitClicked",\r
- "change input": "inputChanged"},\r
-\r
- /* inputChanged is watching the onChange events of the input controls. We\r
- do this to track when this view is 'dirty', so we can throw up a warning\r
- if the user tries to change his slices without saving first.\r
- */\r
-\r
- inputChanged: function(e) {\r
- this.dirty = true;\r
- },\r
-\r
- saveError: function(model, result, xhr) {\r
- TestApp.showError(result);\r
- },\r
-\r
- saveSuccess: function(model, result, xhr) {\r
- TestApp.showSuccess({status: xhr.xhr.status, statusText: xhr.xhr.statusText});\r
- },\r
-\r
- submitClicked: function(e) {\r
- TestApp.hideError();\r
- e.preventDefault();\r
- var data = Backbone.Syphon.serialize(this);\r
- var thisView = this;\r
- this.model.save(data, {error: function(model, result, xhr) { thisView.saveError(model, result, xhr); },\r
- success: function(model, result, xhr) { thisView.saveSuccess(model, result, xhr); }});\r
- this.dirty = false;\r
- },\r
- });