Skip to content

Commit 5843d50

Browse files
authored
FEATURE: Add custom title to top-contributors block (#48)
1 parent a441193 commit 5843d50

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

.DS_Store

-8 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
.discourse-site
3+
.DS_Store

README.md

Lines changed: 1 addition & 1 deletion
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 |
4343
| period | Time period for top contributors | yearly | all, yearly, quarterly, monthly, weekly, daily | top-contributors |

javascripts/discourse/components/top-contributors.hbs

Lines changed: 1 addition & 1 deletion
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+
{{this.blockTitle}}
33
</h3>
44

55
<div class="top-contributors--container">

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 { tracked } from "@glimmer/tracking";
33
import { ajax } from "discourse/lib/ajax";
4+
import { i18n } from "discourse-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(themePrefix("top_contributors.heading"));
1417

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

0 commit comments

Comments
 (0)