Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

team: Migrate total contributor count template to Handlebars.

Anders Kaseorg7e614d1b602b
diff --git a/templates/corporate/team.html b/templates/corporate/team.html
index b206c48204a..ec364cd9d17 100644
--- a/templates/corporate/team.html
+++ b/templates/corporate/team.html
@@ -129,15 +129,6 @@ contributors, and 97+ people with 100+ commits." %}
</div>
</div>
- <!-- Compiled using lodash -->
- <script type="text/template" id="total-count-template">
- <p class="contributor-count">
- <%= contributor_count %> total contributors
- (<%= hundred_plus_contributor_count %> with 100+ commits;
- <%= twenty_plus_contributor_count %> with 20+ commits)
- </p>
- </script>
-
<p class="last-updated">
Last updated: {{ date }}. <a href="https://zulip.readthedocs.io/en/latest/contributing/counting-contributions.html" target="_blank" rel="noopener noreferrer">Methodology</a>.
</p>
diff --git a/web/src/portico/team.ts b/web/src/portico/team.ts
index d2c40c9825f..fc1ae412493 100644
--- a/web/src/portico/team.ts
+++ b/web/src/portico/team.ts
@@ -6,6 +6,7 @@ import "../templates.ts";
import render_contributor_count from "../../templates/team/contributor_count.hbs";
import render_contributors from "../../templates/team/contributors.hbs";
import render_loading from "../../templates/team/loading.hbs";
+import render_total_contributor_count from "../../templates/team/total_contributor_count.hbs";
// The list of repository names is duplicated here in order to provide
// a clear type for Contributor objects.
@@ -139,7 +140,6 @@ function exclude_bot_contributors(contributor: Contributor): boolean {
// - Make tab header responsive.
// - Display full name instead of GitHub username.
export default function render_tabs(contributors: Contributor[]): void {
- const total_count_template = _.template($("#total-count-template").html());
const contributors_list = contributors
? contributors.filter((c) => exclude_bot_contributors(c))
: [];
@@ -163,7 +163,7 @@ export default function render_tabs(contributors: Contributor[]): void {
$("#tab-total .contributors-grid").html(total_tab_html);
$("#tab-total").prepend(
$(
- total_count_template({
+ render_total_contributor_count({
contributor_count: contributors_list.length,
tab_name: "total",
twenty_plus_contributor_count: twenty_plus_total_contributors.length,
diff --git a/web/templates/team/total_contributor_count.hbs b/web/templates/team/total_contributor_count.hbs
new file mode 100644
index 00000000000..c95a658b32a
--- /dev/null
+++ b/web/templates/team/total_contributor_count.hbs
@@ -0,0 +1,5 @@
+<p class="contributor-count">
+ {{contributor_count}} total contributors
+ ({{hundred_plus_contributor_count}} with 100+ commits;
+ {{twenty_plus_contributor_count}} with 20+ commits)
+</p>