0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/app/components/gh-alert.js

35 lines
808 B
JavaScript
Raw Normal View History

2015-05-21 11:03:24 -06:00
import Ember from 'ember';
export default Ember.Component.extend({
2015-05-21 11:03:24 -06:00
tagName: 'article',
classNames: ['gh-alert'],
2015-05-21 11:03:24 -06:00
classNameBindings: ['typeClass'],
notifications: Ember.inject.service(),
typeClass: Ember.computed('message.type', function () {
2015-05-21 11:03:24 -06:00
var classes = '',
type = this.get('message.type'),
typeMapping;
typeMapping = {
success: 'green',
error: 'red',
warn: 'yellow',
info: 'blue'
};
if (typeMapping[type] !== undefined) {
classes += 'gh-alert-' + typeMapping[type];
2015-05-21 11:03:24 -06:00
}
return classes;
}),
actions: {
closeNotification: function () {
this.get('notifications').closeNotification(this.get('message'));
2015-05-21 11:03:24 -06:00
}
}
});