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

IndexPage

Extends:

ComponentPage → IndexPage

The IndexPage component displays the index page, including the welcome hero, the sidebar, and the discussion list.

Member Summary

Public Members
public
public

Method Summary

Public Methods
public

Build an item list for the part of the toolbar which is about taking action on the results.

public

Redirect to the index page using the given sort parameter.

public

Redirect to the index page without a search filter.

public

config(isInitialized: *, context: *)

public

hero(): MithrilComponent

Get the component to display as the hero.

public

init()

public

Mark all discussions as read.

public

Build an item list for the navigation in the sidebar of the index page.

public

Open the composer for a new discussion or prompt the user to login.

public
public

Get parameters to pass to the DiscussionList component.

public

Return the current search query, if any.

public

Build an item list for the sidebar of the index page.

public

Get URL parameters that stick between filter changes.

public

view(): *

public

Build an item list for the part of the toolbar which is concerned with how the results are displayed.

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.

From class Page
public

A class name to apply to the body while the route is active.

public

config(isInitialized: *, context: *)

public

init()

Public Members

public bodyClass: string source

A class name to apply to the body while the route is active.

Override:

Page#bodyClass

public lastDiscussion: * source

Public Methods

public actionItems(): ItemList source

Build an item list for the part of the toolbar which is about taking action on the results. By default this is just a "mark all as read" button.

Return:

ItemList

public changeSort(sort: String) source

Redirect to the index page using the given sort parameter.

Params:

NameTypeAttributeDescription
sort String

public clearSearch() source

Redirect to the index page without a search filter. This is called when the 'x' is clicked in the search box in the header.

See:

public config(isInitialized: *, context: *) 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:

Page#config

Params:

NameTypeAttributeDescription
isInitialized *
context *

public hero(): MithrilComponent source

Get the component to display as the hero.

Return:

MithrilComponent

public init() source

Called when the component is constructed.

Override:

Page#init

public markAllAsRead(): * source

Mark all discussions as read.

Return:

*

void

public navItems(): ItemList source

Build an item list for the navigation in the sidebar of the index page. By default this is just the 'All Discussions' link.

Return:

ItemList

public newDiscussionAction(): Promise source

Open the composer for a new discussion or prompt the user to login.

Return:

Promise

public onunload() source

Called when the component is destroyed, i.e. after a redraw where it is no longer a part of the view.

Override:

Component#onunload

public params(): Object source

Get parameters to pass to the DiscussionList component.

Return:

Object

public searching(): String source

Return the current search query, if any. This is implemented to activate the search box in the header.

Return:

String

See:

public sidebarItems(): ItemList source

Build an item list for the sidebar of the index page. By default this is a "New Discussion" button, and then a DropdownSelect component containing a list of navigation items.

Return:

ItemList

public stickyParams(): Object source

Get URL parameters that stick between filter changes.

Return:

Object

public view(): * source

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

Override:

Component#view

Return:

*

public viewItems(): ItemList source

Build an item list for the part of the toolbar which is concerned with how the results are displayed. By default this is just a select box to change the way discussions are sorted.

Return:

ItemList