Skip to content

Commit 48635ff

Browse files
Merge pull request rust-lang#1242 from GuillaumeGomez/make-repository-link-more-obvious
Make it more obvious that this is the repository link
2 parents f081d03 + 649e8dc commit 48635ff

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

src/web/crate_details.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct GitHubMetadata {
5353
stars: i32,
5454
forks: i32,
5555
issues: i32,
56+
name: Option<String>,
5657
}
5758

5859
fn optional_markdown<S>(markdown: &Option<String>, serializer: S) -> Result<S::Ok, S::Error>
@@ -101,6 +102,7 @@ impl CrateDetails {
101102
github_repos.stars AS github_stars,
102103
github_repos.forks AS github_forks,
103104
github_repos.issues AS github_issues,
105+
github_repos.name AS github_name,
104106
releases.is_library,
105107
releases.yanked,
106108
releases.doc_targets,
@@ -136,6 +138,7 @@ impl CrateDetails {
136138
issues: krate.get("github_issues"),
137139
stars: krate.get("github_stars"),
138140
forks: krate.get("github_forks"),
141+
name: krate.get("github_name"),
139142
})
140143
} else {
141144
None

src/web/page/templates.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ impl tera::Filter for IconType {
301301
let mut aria_hidden = true;
302302
let icon_name = tera::escape_html(value.as_str().expect("Icons only take strings"));
303303
let class = if args.get("fw").and_then(|fw| fw.as_bool()).unwrap_or(false) {
304-
"class=\"fa-svg fa-svg-fw\""
304+
"fa-svg fa-svg-fw"
305305
} else {
306-
"class=\"fa-svg\""
306+
"fa-svg"
307307
};
308308
let aria_label = args
309309
.get("aria-label")
@@ -332,9 +332,12 @@ impl tera::Filter for IconType {
332332
let icon_file_string = font_awesome_as_a_crate::svg(type_, &icon_name[..]).unwrap_or("");
333333

334334
let icon = format!(
335-
r#"<span {class} aria-hidden="{aria_hidden}"{aria_label}{id}>{icon_file_string}</span>"#,
335+
"<span \
336+
class=\"{class} {class_extra}\" \
337+
aria-hidden=\"{aria_hidden}\"{aria_label}{id}>{icon_file_string}</span>",
336338
icon_file_string = icon_file_string,
337339
class = class,
340+
class_extra = args.get("extra").and_then(|s| s.as_str()).unwrap_or(""),
338341
aria_hidden = aria_hidden,
339342
aria_label = aria_label,
340343
id = id,

templates/crate/details.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@
7676
{# TODO: add support for hosts besides github (#35) #}
7777
{%- if details.github_metadata -%}
7878
{{ "github" | fab(fw=true) }}
79-
{{ "star" | fas(fw=true) }} {{ details.github_metadata.stars }}
79+
{% if details.github_metadata.name %}
80+
{{details.github_metadata.name}}
81+
{% else %}
82+
Repository
83+
{% endif %}
84+
<br>
85+
{{ "star" | fas(fw=true, extra="left-margin") }} {{ details.github_metadata.stars }}
8086
{{ "code-branch" | fas(fw=true) }} {{ details.github_metadata.forks }}
8187
{{ "exclamation-circle" | fas(fw=true) }} {{ details.github_metadata.issues }}
8288

templates/rustdoc/topbar.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@
6262
{%- if krate.github_metadata -%}
6363
<li class="pure-menu-item">
6464
<a href="{{ krate.repository_url }}" class="pure-menu-link">
65-
{{ "github" | fab(fw=true) }}
66-
{{ "star" | fas(fw=true) }} {{ krate.github_metadata.stars }}
67-
{{ "code-branch" | fas(fw=true) }} {{ krate.github_metadata.forks }}
68-
{{ "exclamation-circle" | fas(fw=true) }} {{ krate.github_metadata.issues }}
65+
{{ "code-branch" | fas(fw=true) }} Repository
6966
</a>
7067
</li>
7168

templates/style/_fa.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
display: inline-block;
55
}
66

7+
.fa-svg.left-margin {
8+
margin-left: 1.25em;
9+
}
10+
711
.fa-svg svg {
812
width: 1em;
913
height: 1em;

0 commit comments

Comments
 (0)