1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

[1.x] [extensibility] refactor(core): improve extensibility of IndexPage (#4045)

* refactor(core): improve extensibility of `IndexPage`

* refactor(core): refactor the extensibility refactor
This commit is contained in:
Davide Iadeluca
2024-09-30 13:02:58 +02:00
committed by GitHub
parent 306d0bc124
commit dce2549ff7

View File

@@ -60,19 +60,31 @@ export default class IndexPage<CustomAttrs extends IIndexPageAttrs = IIndexPageA
<nav className="IndexPage-nav sideNav">
<ul>{listItems(this.sidebarItems().toArray())}</ul>
</nav>
<div className="IndexPage-results sideNavOffset">
<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} />
</div>
<div className="IndexPage-results sideNavOffset">{this.contentItems().toArray()}</div>
</div>
</div>
</div>
);
}
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);