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

DiscussionPage

Extends:

ComponentPage → DiscussionPage

The DiscussionPage component displays a whole discussion page, including the discussion list pane, the hero, the posts, and the sidebar.

Member Summary

Public Members
public
public

The discussion that is being viewed.

public

near: Integer

The number of the first post that is currently visible in the viewport.

public

stream: *

Method Summary

Public Methods
public

config(args: ...*)

public

configPane(element: DOMElement, isInitialized: Boolean, context: Object)

Configure the discussion list pane.

public

init()

public

onunload(e: *)

public

positionChanged(startNumber: Integer, endNumber: Integer)

When the posts that are visible in the post stream change (i.e.

public

Clear and reload the discussion.

public

Get the parameters that should be passed in the API request to get the discussion.

public

show(discussion: Discussion)

Initialize the component to display the given discussion.

public

Build an item list for the contents of the sidebar.

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.

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 discussion: Discussion source

The discussion that is being viewed.

public near: Integer source

The number of the first post that is currently visible in the viewport.

public stream: * source

Public Methods

public config(args: ...*) 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
args ...*

public configPane(element: DOMElement, isInitialized: Boolean, context: Object) source

Configure the discussion list pane.

Params:

NameTypeAttributeDescription
element DOMElement
isInitialized Boolean
context Object

public init() source

Called when the component is constructed.

Override:

Page#init

public onunload(e: *) 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

Params:

NameTypeAttributeDescription
e *

public positionChanged(startNumber: Integer, endNumber: Integer) source

When the posts that are visible in the post stream change (i.e. the user scrolls up or down), then we update the URL and mark the posts as read.

Params:

NameTypeAttributeDescription
startNumber Integer
endNumber Integer

public refresh() source

Clear and reload the discussion.

public requestParams(): Object source

Get the parameters that should be passed in the API request to get the discussion.

Return:

Object

public show(discussion: Discussion) source

Initialize the component to display the given discussion.

Params:

NameTypeAttributeDescription
discussion Discussion

public sidebarItems(): ItemList source

Build an item list for the contents of the sidebar.

Return:

ItemList

public view(): * source

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

Override:

Component#view

Return:

*