mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Close notifications on user action properly.
fixes #3105, refs #3012 - Add additional closeAll() calls where users interact with data
This commit is contained in:
parent
9c4f427340
commit
1af5eb6248
@ -7,6 +7,9 @@ var PostController = Ember.ObjectController.extend({
|
||||
var featured = this.toggleProperty('featured'),
|
||||
self = this;
|
||||
|
||||
// @TODO This should call closePassive() to only close passive notifications
|
||||
self.notifications.closeAll();
|
||||
|
||||
this.get('model').save().then(function () {
|
||||
self.notifications.showSuccess('Post successfully marked as ' + (featured ? 'featured' : 'not featured') + '.');
|
||||
}).catch(function (errors) {
|
||||
|
@ -9,9 +9,11 @@ var AppStates = {
|
||||
var SettingsAppController = Ember.ObjectController.extend({
|
||||
appState: AppStates.active,
|
||||
buttonText: '',
|
||||
|
||||
setAppState: function () {
|
||||
this.set('appState', this.get('active') ? AppStates.active : AppStates.inactive);
|
||||
}.on('init'),
|
||||
|
||||
buttonTextSetter: function () {
|
||||
switch (this.get('appState')) {
|
||||
case AppStates.active:
|
||||
@ -25,12 +27,15 @@ var SettingsAppController = Ember.ObjectController.extend({
|
||||
break;
|
||||
}
|
||||
}.observes('appState').on('init'),
|
||||
|
||||
activeClass: function () {
|
||||
return this.appState === AppStates.active ? true : false;
|
||||
}.property('appState'),
|
||||
|
||||
inactiveClass: function () {
|
||||
return this.appState === AppStates.inactive ? true : false;
|
||||
}.property('appState'),
|
||||
|
||||
actions: {
|
||||
toggleApp: function (app) {
|
||||
var self = this;
|
||||
|
@ -19,6 +19,10 @@ var SigninController = Ember.ObjectController.extend(ValidationEngine, {
|
||||
loginTransition = appController.get('loginTransition');
|
||||
|
||||
this.toggleProperty('submitting');
|
||||
|
||||
// @TODO This should call closePassive() to only close passive notifications
|
||||
self.notifications.closeAll();
|
||||
|
||||
this.validate({ format: false }).then(function () {
|
||||
ajax({
|
||||
url: self.get('ghostPaths').adminUrl('signin'),
|
||||
@ -38,7 +42,6 @@ var SigninController = Ember.ObjectController.extend(ValidationEngine, {
|
||||
return self.store.find('user', response.userData.id);
|
||||
}).then(function (user) {
|
||||
self.send('signedIn', user);
|
||||
self.notifications.clear();
|
||||
if (loginTransition) {
|
||||
appController.set('loginTransition', null);
|
||||
loginTransition.retry();
|
||||
@ -51,7 +54,6 @@ var SigninController = Ember.ObjectController.extend(ValidationEngine, {
|
||||
});
|
||||
}).catch(function (errors) {
|
||||
self.toggleProperty('submitting');
|
||||
self.notifications.clear();
|
||||
self.notifications.showErrors(errors);
|
||||
});
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ var SignupController = Ember.ObjectController.extend(ValidationEngine, {
|
||||
signup: function () {
|
||||
var self = this;
|
||||
|
||||
// @TODO This should call closePassive() to only close passive notifications
|
||||
self.notifications.closeAll();
|
||||
|
||||
this.toggleProperty('submitting');
|
||||
this.validate({ format: false }).then(function () {
|
||||
ajax({
|
||||
@ -29,7 +32,6 @@ var SignupController = Ember.ObjectController.extend(ValidationEngine, {
|
||||
self.store.pushPayload({ users: [resp.userData]});
|
||||
self.store.find('user', resp.userData.id).then(function (user) {
|
||||
self.send('signedIn', user);
|
||||
self.notifications.clear();
|
||||
self.transitionToRoute('posts');
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user