mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 12:35:44 +08:00
Use an extendable ItemList for notification methods
This commit is contained in:
parent
7721288ac6
commit
ff10ed0ea9
|
@ -18,10 +18,7 @@ export default class NotificationGrid extends Component {
|
|||
*
|
||||
* @type {Array}
|
||||
*/
|
||||
this.methods = [
|
||||
{name: 'alert', icon: 'bell', label: app.translator.trans('core.forum.settings.notify_by_web_heading')},
|
||||
{name: 'email', icon: 'envelope-o', label: app.translator.trans('core.forum.settings.notify_by_email_heading')}
|
||||
];
|
||||
this.methods = this.notificationMethods().toArray();
|
||||
|
||||
/**
|
||||
* A map of notification type-method combinations to the checkbox instances
|
||||
|
@ -164,6 +161,35 @@ export default class NotificationGrid extends Component {
|
|||
return 'notify_' + type + '_' + method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an item list for the notification methods to display in the grid.
|
||||
*
|
||||
* Each notification method is an object which has the following properties:
|
||||
*
|
||||
* - `name` The name of the notification method.
|
||||
* - `icon` The icon to display in the column header.
|
||||
* - `label` The label to display in the column header.
|
||||
*
|
||||
* @return {ItemList}
|
||||
*/
|
||||
notificationMethods() {
|
||||
const items = new ItemList();
|
||||
|
||||
items.add('alert', {
|
||||
name: 'alert',
|
||||
icon: 'bell',
|
||||
label: app.translator.trans('core.forum.settings.notify_by_web_heading'),
|
||||
});
|
||||
|
||||
items.add('email', {
|
||||
name: 'email',
|
||||
icon: 'envelope-o',
|
||||
label: app.translator.trans('core.forum.settings.notify_by_email_heading'),
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an item list for the notification types to display in the grid.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user