fixed saving settings. now done more generically.

This commit is contained in:
kay.one 2013-06-18 21:27:41 -07:00
parent d126c6efc1
commit 806e58ed1f
13 changed files with 104 additions and 161 deletions

View file

@ -5,11 +5,10 @@ define([
'marionette',
'Settings/Notifications/Model',
'Settings/Notifications/DeleteView',
'Settings/SyncNotification',
'Shared/Messenger',
'Mixins/AsModelBoundView'
], function (App, Marionette, NotificationModel, DeleteView, SyncNotification, Messenger, AsModelBoundView) {
], function (App, Marionette, NotificationModel, DeleteView, Messenger, AsModelBoundView) {
var model = Marionette.ItemView.extend({
template: 'Settings/Notifications/EditTemplate',
@ -30,16 +29,11 @@ define([
},
_saveNotification: function () {
var name = this.model.get('name');
var success = 'Notification Saved: ' + name;
var fail = 'Failed to save notification: ' + name;
var promise = this.model.saveSettings();
this.model.save(undefined, SyncNotification.callback({
successMessage : success,
errorMessage : fail,
successCallback: this._saveSuccess,
context : this
}));
if (promise) {
promise.done(this._saveSuccess);
}
},
_deleteNotification: function () {