mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 15:51: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}
|
* @type {Array}
|
||||||
*/
|
*/
|
||||||
this.methods = [
|
this.methods = this.notificationMethods().toArray();
|
||||||
{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')}
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map of notification type-method combinations to the checkbox instances
|
* 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;
|
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.
|
* Build an item list for the notification types to display in the grid.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user