mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 22:02:11 +03:00
48e3bf003d
no issue - https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/order-in-components.md - https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/order-in-controllers.md - https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/order-in-routes.md
37 lines
875 B
JavaScript
37 lines
875 B
JavaScript
import Component from '@ember/component';
|
|
import {computed} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default Component.extend({
|
|
notifications: service(),
|
|
|
|
classNameBindings: ['typeClass'],
|
|
classNames: ['gh-alert'],
|
|
tagName: 'article',
|
|
|
|
typeClass: computed('message.type', function () {
|
|
let type = this.get('message.type');
|
|
let classes = '';
|
|
let typeMapping;
|
|
|
|
typeMapping = {
|
|
success: 'green',
|
|
error: 'red',
|
|
warn: 'blue',
|
|
info: 'blue'
|
|
};
|
|
|
|
if (typeMapping[type] !== undefined) {
|
|
classes += `gh-alert-${typeMapping[type]}`;
|
|
}
|
|
|
|
return classes;
|
|
}),
|
|
|
|
actions: {
|
|
closeNotification() {
|
|
this.get('notifications').closeNotification(this.get('message'));
|
|
}
|
|
}
|
|
});
|