Skip to content

Commit 28d34bb

Browse files
committed
Include roles and leadership status in the person page
1 parent 1356416 commit 28d34bb

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

src/teams.rs

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl RustTeams {
263263
TeamMode::Member | TeamMode::Alumni => ctx.get_toplevel_team_url(team),
264264
TeamMode::MemberOfArchivedTeam => Some("archived-teams.html".to_string()),
265265
};
266-
teams.push(PersonTeam::new(team, url));
266+
teams.push(PersonTeam::new(team, member, url));
267267
}
268268

269269
for team in &self.archived_teams {
@@ -378,32 +378,41 @@ pub struct PersonTeam {
378378
team: Team,
379379
toplevel_url: Option<String>,
380380
webpage_name: String,
381+
roles: Vec<String>,
381382
}
382383

383384
impl PersonTeam {
384-
fn new(team: &Team, toplevel_url: Option<String>) -> Self {
385+
fn new(team: &Team, member: &TeamMember, toplevel_url: Option<String>) -> Self {
386+
// Turn inside-rust-reviewers into Inside Rust Reviewers
387+
let normalize_name = |name: &str| {
388+
name.split("-")
389+
.map(|p| {
390+
p.chars()
391+
.take(1)
392+
.flat_map(|c| c.to_uppercase())
393+
.chain(p.chars().skip(1))
394+
.collect::<String>()
395+
})
396+
.collect::<Vec<String>>()
397+
.join(" ")
398+
};
399+
385400
let webpage_name = team
386401
.website_data
387402
.as_ref()
388403
.map(|w| w.name.clone())
389-
.unwrap_or_else(|| {
390-
// Turn inside-rust-reviewers into Inside Rust Reviewers
391-
team.name
392-
.split("-")
393-
.map(|p| {
394-
p.chars()
395-
.take(1)
396-
.flat_map(|c| c.to_uppercase())
397-
.chain(p.chars().skip(1))
398-
.collect::<String>()
399-
})
400-
.collect::<Vec<String>>()
401-
.join(" ")
402-
});
404+
.unwrap_or_else(|| normalize_name(&team.name));
405+
406+
let mut roles = vec![];
407+
if member.is_lead {
408+
roles.push("Lead".to_string());
409+
}
410+
roles.extend(member.roles.iter().map(|r| normalize_name(r)));
403411
Self {
404412
team: team.clone(),
405413
toplevel_url,
406414
webpage_name,
415+
roles,
407416
}
408417
}
409418
}

templates/governance/person.html.hbs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@
33
<li>
44
{{#if team.toplevel_url }}
55
<a href="{{../baseurl}}/governance/{{team.toplevel_url}}{{ team-anchor team.team }}">
6-
{{ team.webpage_name }}
7-
</a>
6+
{{ team.webpage_name }}</a>
87
{{else}}
98
{{ team.webpage_name }}
109
{{/if}}
10+
{{#if team.roles }}
11+
({{~#each team.roles as |role index|~}}
12+
{{#if (eq index 0)~}}
13+
<b>{{role}}</b>{{~else~}}, <b>{{role}}</b>
14+
{{~/if}}
15+
{{~/each~}})
16+
{{/if}}
1117
</li>
1218
{{/each}}
1319
{{/inline}}
1420

1521
{{#*inline "page"}}
1622
<section class="green" style="padding-bottom: 10px;">
17-
<div class="w-100 mw-none mw-8-m mw9-l center f2">
18-
<div class="w-100 w-50-l mb3 flex flex-row items-center">
19-
<a class="mr4 w4 h4 flex-shrink-0" href="https://github.com/{{data.github}}">
23+
<div class="w-100 mw-none mw-8-m mw9-l center f1">
24+
<div class="w-100 w-50-l mb3 flex flex-row items-start">
25+
<a class="mr4 w5 h5 flex-shrink-0" href="https://github.com/{{data.github}}">
2026
<img class="w-100 h-100 bg-white br2"
2127
src="https://avatars.githubusercontent.com/{{data.github}}"
2228
alt="{{data.name}}">

0 commit comments

Comments
 (0)