From 866200c2a2e3d009cecb233707186a47822d937f Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 26 Feb 2015 13:28:44 +1030 Subject: [PATCH] Fix alerts not dismissing --- framework/core/ember/app/adapters/application.js | 2 +- framework/core/ember/app/controllers/alerts.js | 2 +- framework/core/ember/app/routes/application.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/core/ember/app/adapters/application.js b/framework/core/ember/app/adapters/application.js index 595489cbd..8487c2565 100644 --- a/framework/core/ember/app/adapters/application.js +++ b/framework/core/ember/app/adapters/application.js @@ -31,7 +31,7 @@ export default JsonApiAdapter.extend({ } else { message = errors.message; } - var alert = AlertMessage.create({ + var alert = AlertMessage.extend({ type: 'warning', message: message }); diff --git a/framework/core/ember/app/controllers/alerts.js b/framework/core/ember/app/controllers/alerts.js index 1ce9f27f4..562f165ae 100644 --- a/framework/core/ember/app/controllers/alerts.js +++ b/framework/core/ember/app/controllers/alerts.js @@ -8,7 +8,7 @@ export default Ember.Controller.extend({ this.get('alerts').pushObject(message); }, dismissAlert: function(message) { - this.get('alerts').removeObject(message); + this.get('alerts').removeObject(message.constructor); }, clearAlerts: function() { this.get('alerts').clear(); diff --git a/framework/core/ember/app/routes/application.js b/framework/core/ember/app/routes/application.js index bf0e1ae78..47a3aa973 100644 --- a/framework/core/ember/app/routes/application.js +++ b/framework/core/ember/app/routes/application.js @@ -6,7 +6,7 @@ import AlertMessage from 'flarum/components/ui/alert-message'; export default Ember.Route.extend(ApplicationRouteMixin, { activate: function() { if (!Ember.isEmpty(FLARUM_ALERT)) { - this.controllerFor('alerts').send('alert', AlertMessage.create(FLARUM_ALERT)); + this.controllerFor('alerts').send('alert', AlertMessage.extend(FLARUM_ALERT)); FLARUM_ALERT = null; }