Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render custom roles #1904

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions locales/en-US/teams.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,5 @@ governance-team-wg-triage-description = Triaging repositories under the rust-lan

governance-team-wg-wasm-name = WebAssembly (WASM) working group
governance-team-wg-wasm-description = Improving on the end-to-end experience of embedding Rust code in JS libraries and apps via WebAssembly

governance-role-spec-editor = Editor
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ use sass_rs::{compile_file, Options};
use category::Category;

use caching::CachedNamedFile;
use handlebars::handlebars_helper;
use handlebars_fluent::{loader::Loader, FluentHelper};
use i18n::{create_loader, LocaleInfo, SupportedLocale, TeamHelper, EXPLICIT_LOCALE_INFO};

Expand Down Expand Up @@ -491,6 +492,11 @@ async fn rocket() -> _ {
engine
.handlebars
.register_helper("encode-zulip-stream", Box::new(encode_zulip_stream));

handlebars_helper!(concat: |x: String, y: String| x + &y);
engine
.handlebars
.register_helper("concat", Box::new(concat));
});

let rust_version = RustVersion::fetch().await.unwrap_or_default();
Expand Down
13 changes: 11 additions & 2 deletions src/teams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,26 @@ mod tests {
kind: TeamKind::Team,
subteam_of: None,
members: vec![
TeamMember {
name: "Jupiter Doe".into(),
github: "jupiterd".into(),
github_id: 123,
is_lead: false,
roles: vec!["convener".to_owned()],
},
TeamMember {
name: "John Doe".into(),
github: "johnd".into(),
github_id: 456,
is_lead: false,
github_id: 1234,
roles: Vec::new(),
},
TeamMember {
name: "Jane Doe".into(),
github: "janed".into(),
github_id: 789,
is_lead: true,
github_id: 1234,
roles: Vec::new(),
},
],
alumni: Vec::new(),
Expand Down
4 changes: 4 additions & 0 deletions templates/governance/group-team.html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
</div>
{{#if member.is_lead}}
<div>{{fluent "governance-user-team-leader"}}</div>
{{else}}
{{#if member.roles}}
<div>{{fluent (concat "governance-role-" (lookup member.roles 0))}}</div>
{{/if}}
{{/if}}
</div>
</div>
Expand Down
Loading