Skip to content

Commit c292ff4

Browse files
authored
Add custom title to top-contributors block
1 parent ab5005a commit c292ff4

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You can control some features for the provided blocks via parameters.
3737
| id | leaderboard id | | number | minimal-gamification-leaderboard |
3838
| tag | which tag to display | | tag id | tag-topics |
3939
| period | time period of top topics | weekly | all, yearly, quarterly, monthly, weekly, daily | top-topics |
40-
| title | title of the block | varies | string | tag-topics, category-list |
40+
| title | title of the block | varies | string | tag-topics, category-list, top-contributors |
4141
| excludedGroupNames | Excludes specified groups | | Group names | top-contributors |
4242
| order | Orders the contributors | likes_received | String (likes_received or likes_given) | top-contributors |
43-
| period | Time period for top contributors | yearly | all, yearly, quarterly, monthly, weekly, daily | top-contributors |
43+
| period | Time period for top contributors | yearly | all, yearly, quarterly, monthly, weekly, daily | top-contributors |

javascripts/discourse/components/category-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default class CategoryList extends Component {
66
constructor() {
77
super(...arguments);
88
this.blockTitle =
9-
this.args?.params?.title || I18n.t(themePrefix("category_list.heading"));
9+
this.args?.params?.title || I18n.t(themePrefix("top_contributors.heading"));
1010

1111
this.categoryList = this.args?.params?.id.split(",");
1212
if (!this.categoryList) {

javascripts/discourse/components/top-contributors.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Component from "@glimmer/component";
22
import { ajax } from "discourse/lib/ajax";
33
import { tracked } from "@glimmer/tracking";
4+
import I18n from "I18n";
45

56
export default class TopContributors extends Component {
67
@tracked topContributors = null;
@@ -11,6 +12,8 @@ export default class TopContributors extends Component {
1112

1213
constructor() {
1314
super(...arguments);
15+
this.blockTitle =
16+
this.args?.params?.title || I18n.t(themePrefix("category_list.heading"));
1417

1518
ajax(this.requestURL).then((data) => {
1619
this.topContributors = data.directory_items?.slice(0, this.count);

javascripts/discourse/templates/components/top-contributors.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h3 class="top-contributors-heading">
2-
{{theme-i18n "top_contributors.heading"}}
2+
{{blockTitle}}
33
</h3>
44

55
<div class="top-contributors--container">
@@ -30,4 +30,4 @@
3030
href={{this.viewAllUrl}}
3131
>
3232
{{theme-i18n "top_contributors.view_all"}}
33-
</a>
33+
</a>

0 commit comments

Comments
 (0)