Skip to content

Commit b352151

Browse files
authored
Merge pull request #1904 from dtolnay-contrib/roles
Render custom roles
2 parents 439e4cc + ef99d3e commit b352151

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

Cargo.lock

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

locales/en-US/teams.ftl

+2
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,5 @@ governance-team-wg-triage-description = Triaging repositories under the rust-lan
289289
290290
governance-team-wg-wasm-name = WebAssembly (WASM) working group
291291
governance-team-wg-wasm-description = Improving on the end-to-end experience of embedding Rust code in JS libraries and apps via WebAssembly
292+
293+
governance-role-spec-editor = Editor

src/main.rs

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ use sass_rs::{compile_file, Options};
5959
use category::Category;
6060

6161
use caching::CachedNamedFile;
62+
use handlebars::handlebars_helper;
6263
use handlebars_fluent::{loader::Loader, FluentHelper};
6364
use i18n::{create_loader, LocaleInfo, SupportedLocale, TeamHelper, EXPLICIT_LOCALE_INFO};
6465

@@ -491,6 +492,11 @@ async fn rocket() -> _ {
491492
engine
492493
.handlebars
493494
.register_helper("encode-zulip-stream", Box::new(encode_zulip_stream));
495+
496+
handlebars_helper!(concat: |x: String, y: String| x + &y);
497+
engine
498+
.handlebars
499+
.register_helper("concat", Box::new(concat));
494500
});
495501

496502
let rust_version = RustVersion::fetch().await.unwrap_or_default();

src/teams.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,26 @@ mod tests {
298298
kind: TeamKind::Team,
299299
subteam_of: None,
300300
members: vec![
301+
TeamMember {
302+
name: "Jupiter Doe".into(),
303+
github: "jupiterd".into(),
304+
github_id: 123,
305+
is_lead: false,
306+
roles: vec!["convener".to_owned()],
307+
},
301308
TeamMember {
302309
name: "John Doe".into(),
303310
github: "johnd".into(),
311+
github_id: 456,
304312
is_lead: false,
305-
github_id: 1234,
313+
roles: Vec::new(),
306314
},
307315
TeamMember {
308316
name: "Jane Doe".into(),
309317
github: "janed".into(),
318+
github_id: 789,
310319
is_lead: true,
311-
github_id: 1234,
320+
roles: Vec::new(),
312321
},
313322
],
314323
alumni: Vec::new(),

templates/governance/group-team.html.hbs

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
</div>
6161
{{#if member.is_lead}}
6262
<div>{{fluent "governance-user-team-leader"}}</div>
63+
{{else}}
64+
{{#if member.roles}}
65+
<div>{{fluent (concat "governance-role-" (lookup member.roles 0))}}</div>
66+
{{/if}}
6367
{{/if}}
6468
</div>
6569
</div>

0 commit comments

Comments
 (0)