mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 12:35:44 +08:00
Merge pull request #1361 from clarkwinkelmann/extendable-notification-methods
Extendable notification methods
This commit is contained in:
commit
aff1b9a5e4
|
@ -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
|
||||
|
@ -34,7 +31,7 @@ export default class NotificationGrid extends Component {
|
|||
/**
|
||||
* Information about the available notification types.
|
||||
*
|
||||
* @type {Object}
|
||||
* @type {Array}
|
||||
*/
|
||||
this.types = this.notificationTypes().toArray();
|
||||
|
||||
|
@ -164,12 +161,42 @@ 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.
|
||||
*
|
||||
* Each notification type is an object which has the following properties:
|
||||
*
|
||||
* - `name` The name of the notification type.
|
||||
* - `icon` The icon to display in the notification grid row.
|
||||
* - `label` The label to display in the notification grid row.
|
||||
*
|
||||
* @return {ItemList}
|
||||
|
|
Loading…
Reference in New Issue
Block a user