mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 09:00:55 +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() {
|
view() {
|
||||||
return (
|
return (
|
||||||
<PageStructure className="IndexPage" hero={this.hero.bind(this)} sidebar={this.sidebar.bind(this)}>
|
<PageStructure className="IndexPage" hero={this.hero.bind(this)} sidebar={this.sidebar.bind(this)}>
|
||||||
<div className="IndexPage-toolbar">
|
{this.contentItems().toArray()}
|
||||||
<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} />
|
|
||||||
</PageStructure>
|
</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() {
|
setTitle() {
|
||||||
app.setTitle(extractText(app.translator.trans('core.forum.index.meta_title_text')));
|
app.setTitle(extractText(app.translator.trans('core.forum.index.meta_title_text')));
|
||||||
app.setTitleCount(0);
|
app.setTitleCount(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user