Ghost/core/client/utils/notifications.js
Matt Enlow ff5af6c29b Create Post Settings Menu and its functionality on the Post controller.
closes #2419
- Added blur-text-field component, which fires actions on focusOut
- Added utils/date-formatting for moment & date functionality  consolidation
- Added functionality to PostsPostController
- Added fixtures: posts/3 & posts/4, posts/slug/test%20title/
- Added Post model saving
- Set posts.post as controller for EditorRoute
- Added PostSettingsMenuView and template
- Added "showErrors" convenience method to notifications
2014-04-20 13:28:43 -06:00

44 lines
1.1 KiB
JavaScript

var Notifications = Ember.ArrayProxy.extend({
content: Ember.A(),
timeout: 3000,
pushObject: function (object) {
object.typeClass = 'notification-' + object.type;
// This should be somewhere else.
if (object.type === 'success') {
object.typeClass = object.typeClass + " notification-passive";
}
this._super(object);
},
showError: function (message) {
this.pushObject({
type: 'error',
message: message
});
},
showErrors: function (errors) {
for (var i = 0; i < errors.length; i += 1) {
this.showError(errors[i].message || errors[i]);
}
},
showInfo: function (message) {
this.pushObject({
type: 'info',
message: message
});
},
showSuccess: function (message) {
this.pushObject({
type: 'success',
message: message
});
},
showWarn: function (message) {
this.pushObject({
type: 'warn',
message: message
});
}
});
export default Notifications;