Merge pull request #3181 from jaswilli/ember-misc

Prevent stacking notifications during rapid toggle
This commit is contained in:
Hannah Wolfe 2014-07-02 21:36:40 +01:00
commit 4043f7dfcb
4 changed files with 5 additions and 8 deletions

View File

@ -11,7 +11,6 @@ var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, {
if (model.get('id')) {
self.transitionToRoute('editor.edit', model);
}
return model;
});
}
}

View File

@ -7,13 +7,12 @@ var PostController = Ember.ObjectController.extend({
var featured = this.toggleProperty('featured'),
self = this;
self.notifications.closePassive();
this.get('model').save().then(function () {
self.notifications.closePassive();
self.notifications.showSuccess('Post successfully marked as ' + (featured ? 'featured' : 'not featured') + '.');
}).catch(function (errors) {
self.notifications.closePassive();
self.notifications.showErrors(errors);
return Ember.RSVP.reject(errors);
});
}
}

View File

@ -30,16 +30,14 @@ var SettingsGeneralController = Ember.ObjectController.extend({
save: function () {
var self = this;
self.notifications.closePassive();
return this.get('model').save().then(function (model) {
self.notifications.closePassive();
self.notifications.showSuccess('Settings successfully saved.');
return model;
}).catch(function (errors) {
self.notifications.closePassive();
self.notifications.showErrors(errors);
return Ember.RSVP.reject(errors);
});
},
}

View File

@ -12,6 +12,7 @@ var SigninController = Ember.Controller.extend(Ember.SimpleAuth.LoginControllerM
this.validate({ format: false }).then(function () {
self.send('authenticate');
}).catch(function (errors) {
self.notifications.closePassive();
self.notifications.showErrors(errors);
});
}