mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 09:52:09 +03:00
7ac6ebb920
issue #5409 - change persistent/passive notification status to alert/notification - replace showSuccess/Info/Warn/Error with showNotification/showAlert - fix and clean up notification/alert components
36 lines
837 B
JavaScript
36 lines
837 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.Component.extend({
|
|
tagName: 'article',
|
|
classNames: ['gh-alert'],
|
|
classNameBindings: ['typeClass'],
|
|
|
|
notifications: Ember.inject.service(),
|
|
|
|
typeClass: Ember.computed(function () {
|
|
var classes = '',
|
|
message = this.get('message'),
|
|
type = Ember.get(message, 'type'),
|
|
typeMapping;
|
|
|
|
typeMapping = {
|
|
success: 'green',
|
|
error: 'red',
|
|
warn: 'yellow',
|
|
info: 'blue'
|
|
};
|
|
|
|
if (typeMapping[type] !== undefined) {
|
|
classes += 'gh-alert-' + typeMapping[type];
|
|
}
|
|
|
|
return classes;
|
|
}),
|
|
|
|
actions: {
|
|
closeNotification: function () {
|
|
this.get('notifications').closeNotification(this.get('message'));
|
|
}
|
|
}
|
|
});
|