Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
team: Migrate contributor count template to Handlebars.
Anders Kaseorg7d9ea6633089
diff --git a/templates/corporate/team.html b/templates/corporate/team.htmlindex 7cdc210f4db..b206c48204a 100644--- a/templates/corporate/team.html+++ b/templates/corporate/team.html@@ -138,18 +138,6 @@ contributors, and 97+ people with 100+ commits." %}</p></script>- <script type="text/template" id="count-template">- <p class="contributor-count">- <%= contributor_count %> contributors- (<%= hundred_plus_contributor_count %> with 100+ commits) to- <% repo_list.forEach(function(repo_name, index) { %>- <a href="<%= repo_url_list[index] %>" target="_blank" rel="noopener noreferrer">- zulip/<%= repo_name %><% if (index < repo_list.length - 1) { %>, <% } %>- </a>- <% }); %>- </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.tsindex b339f8e7513..d2c40c9825f 100644--- a/web/src/portico/team.ts+++ b/web/src/portico/team.ts@@ -3,6 +3,7 @@ import _ from "lodash";import assert from "minimalistic-assert";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";@@ -138,7 +139,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 count_template = _.template($("#count-template").html());const total_count_template = _.template($("#total-count-template").html());const contributors_list = contributors? contributors.filter((c) => exclude_bot_contributors(c))@@ -220,15 +220,15 @@ export default function render_tabs(contributors: Contributor[]): void {const commits = c.total_commits;return commits >= 20;}).length;- const repo_url_list = repo_list.map(- (repo_name) => `https://github.com/zulip/${repo_name}`,- );+ const repos = repo_list.map((name) => ({+ name,+ url: `https://github.com/zulip/${name}`,+ }));$(`#tab-${CSS.escape(tab_name)}`).prepend($(- count_template({+ render_contributor_count({contributor_count,- repo_list,- repo_url_list,+ repos,twenty_plus_contributor_count,hundred_plus_contributor_count,}),diff --git a/web/templates/team/contributor_count.hbs b/web/templates/team/contributor_count.hbsnew file mode 100644index 00000000000..0674ad43be3--- /dev/null+++ b/web/templates/team/contributor_count.hbs@@ -0,0 +1,9 @@+<p class="contributor-count">+ {{contributor_count}} contributors+ ({{hundred_plus_contributor_count}} with 100+ commits) to+ {{#each repos as |repo|}}+ <a href="{{repo.url}}" target="_blank" rel="noopener noreferrer">+ zulip/{{repo.name}}{{#unless @last}}, {{/unless}}+ </a>+ {{/each}}+</p>