Skip to content

Commit 12d21cd

Browse files
[1.x] [extensibility] refactor(core): allow labels of PostStreamScrubber to be customized (flarum#4049)
* refactor(core): allow labels to be customized * chore: change type annotation * chore: remove type annotations Importing `NestedStringArray` did cause issues in the CI
1 parent 359681f commit 12d21cd

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

framework/core/js/src/forum/components/PostStreamScrubber.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default class PostStreamScrubber extends Component {
6464
<div className="Dropdown-menu dropdown-menu">
6565
<div className="Scrubber">
6666
<a className="Scrubber-first" onclick={this.goToFirst.bind(this)}>
67-
{icon('fas fa-angle-double-up')} {app.translator.trans('core.forum.post_scrubber.original_post_link')}
67+
{icon('fas fa-angle-double-up')} {this.firstPostLabel()}
6868
</a>
6969

7070
<div className="Scrubber-scrollbar">
@@ -79,19 +79,31 @@ export default class PostStreamScrubber extends Component {
7979
<div className="Scrubber-after" />
8080

8181
<div className="Scrubber-unread" oncreate={styleUnread} onupdate={styleUnread}>
82-
{app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount })}
82+
{this.unreadLabel(unreadCount)}
8383
</div>
8484
</div>
8585

8686
<a className="Scrubber-last" onclick={this.goToLast.bind(this)}>
87-
{icon('fas fa-angle-double-down')} {app.translator.trans('core.forum.post_scrubber.now_link')}
87+
{icon('fas fa-angle-double-down')} {this.lastPostLabel()}
8888
</a>
8989
</div>
9090
</div>
9191
</div>
9292
);
9393
}
9494

95+
firstPostLabel() {
96+
return app.translator.trans('core.forum.post_scrubber.original_post_link');
97+
}
98+
99+
unreadLabel(unreadCount) {
100+
return app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount });
101+
}
102+
103+
lastPostLabel() {
104+
return app.translator.trans('core.forum.post_scrubber.now_link');
105+
}
106+
95107
onupdate(vnode) {
96108
super.onupdate(vnode);
97109

0 commit comments

Comments
 (0)