Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions framework/core/js/src/forum/components/IndexPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading