mirror of
https://github.com/flarum/framework.git
synced 2025-02-19 07:13:24 +08:00
feat: improve extensibility of IndexPage
(#4182)
This commit is contained in:
parent
5dc94bf4e8
commit
41d62b8c82
|
@ -63,15 +63,29 @@ export default class IndexPage<CustomAttrs extends IIndexPageAttrs = IIndexPageA
|
|||
view() {
|
||||
return (
|
||||
<PageStructure className="IndexPage" hero={this.hero.bind(this)} sidebar={this.sidebar.bind(this)}>
|
||||
<div className="IndexPage-toolbar">
|
||||
<ul className="IndexPage-toolbar-view">{listItems(this.viewItems().toArray())}</ul>
|
||||
<ul className="IndexPage-toolbar-action">{listItems(this.actionItems().toArray())}</ul>
|
||||
</div>
|
||||
<DiscussionList state={app.discussions} />
|
||||
{this.contentItems().toArray()}
|
||||
</PageStructure>
|
||||
);
|
||||
}
|
||||
|
||||
contentItems(): ItemList<Mithril.Children> {
|
||||
const items = new ItemList<Mithril.Children>();
|
||||
|
||||
items.add('toolbar', <div className="IndexPage-toolbar">{this.toolbarItems().toArray()}</div>, 100);
|
||||
items.add('discussionList', <DiscussionList state={app.discussions} />, 90);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
toolbarItems(): ItemList<Mithril.Children> {
|
||||
const items = new ItemList<Mithril.Children>();
|
||||
|
||||
items.add('view', <ul className="IndexPage-toolbar-view">{listItems(this.viewItems().toArray())}</ul>, 100);
|
||||
items.add('action', <ul className="IndexPage-toolbar-action">{listItems(this.actionItems().toArray())}</ul>, 90);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
setTitle() {
|
||||
app.setTitle(extractText(app.translator.trans('core.forum.index.meta_title_text')));
|
||||
app.setTitleCount(0);
|
||||
|
|
Loading…
Reference in New Issue
Block a user