Reference Source
import NotificationGrid from 'flarum/components/NotificationGrid'
public class | source

NotificationGrid

Extends:

Component → NotificationGrid

The NotificationGrid component displays a table of notification types and methods, allowing the user to toggle each combination.

Props

  • user

Member Summary

Public Members
public

A map of notification type-method combinations to the checkbox instances that represent them.

public

Information about the available notification methods.

public

Information about the available notification types.

Method Summary

Public Methods
public

config(isInitialized: *)

public

init()

public

Build an item list for the notification methods to display in the grid.

public

Build an item list for the notification types to display in the grid.

public

preferenceKey(type: String, method: String): String

Get the name of the preference key for the given notification type-method combination.

public

toggle(keys: Array)

Toggle the state of the given preferences, based on the value of the first one.

public

toggleMethod(method: String)

Toggle all notification types for the given method.

public

Toggle all notification methods for the given type.

public

view(): *

Inherited Summary

From class Component
public static

component(props: Object, children: *): Object

Get a Mithril component object for this component, preloaded with props.

public static

initProps(props: Object)

Initialize the component's props.

public

element: *

The root DOM element for the component.

public

The properties passed into the component.

public

Whether or not to retain the component's subtree on redraw.

public

$(selector: String): jQuery

Returns a jQuery object for this component's element. If you pass in a selector string, this method will return a jQuery object, using the current element as its buffer.

For example, calling component.$('li') will return a jQuery object containing all of the li elements inside the DOM element of this component.

public

config(isInitialized: Boolean, context: Object, vdom: Object)

Called after the component's root element is redrawn. This hook can be used to perform any actions on the DOM, both on the initial draw and any subsequent redraws. See Mithril's documentation for more information.

public

Called when the component is destroyed, i.e.

public

Get the renderable virtual DOM that represents the component's view.

This should NOT be overridden by subclasses. Subclasses wishing to define their virtual DOM should override Component#view instead.

protected

init()

Called when the component is constructed.

protected

Get the virtual DOM that represents the component's view.

Public Members

public inputs: Object source

A map of notification type-method combinations to the checkbox instances that represent them.

public methods: Array source

Information about the available notification methods.

public types: Array source

Information about the available notification types.

Public Methods

public config(isInitialized: *) source

Called after the component's root element is redrawn. This hook can be used to perform any actions on the DOM, both on the initial draw and any subsequent redraws. See Mithril's documentation for more information.

Override:

Component#config

Params:

NameTypeAttributeDescription
isInitialized *

public init() source

Called when the component is constructed.

Override:

Component#init

public notificationMethods(): ItemList source

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

public notificationTypes(): ItemList source

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

public preferenceKey(type: String, method: String): String source

Get the name of the preference key for the given notification type-method combination.

Params:

NameTypeAttributeDescription
type String
method String

Return:

String

public toggle(keys: Array) source

Toggle the state of the given preferences, based on the value of the first one.

Params:

NameTypeAttributeDescription
keys Array

public toggleMethod(method: String) source

Toggle all notification types for the given method.

Params:

NameTypeAttributeDescription
method String

public toggleType(type: String) source

Toggle all notification methods for the given type.

Params:

NameTypeAttributeDescription
type String

public view(): * source

Get the virtual DOM that represents the component's view.

Override:

Component#view

Return:

*