Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kixiron authored and Joshua Nelson committed Jul 13, 2020
1 parent 561d802 commit 6b74ba1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/web/crate_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ fn map_to_release(conn: &Connection, crate_id: i32, version: String) -> Release
let rows = conn
.query(
"SELECT build_status, yanked
FROM releases
WHERE releases.crate_id = $1 and releases.version = $2;",
FROM releases
WHERE releases.crate_id = $1 and releases.version = $2;",
&[&crate_id, &version],
)
.unwrap();
Expand All @@ -265,7 +265,7 @@ fn map_to_release(conn: &Connection, crate_id: i32, version: String) -> Release

#[derive(Debug, Clone, PartialEq, Serialize)]
struct CrateDetailsPage {
details: Option<CrateDetails>,
details: CrateDetails,
}

impl_webpage! {
Expand All @@ -282,7 +282,7 @@ pub fn crate_details_handler(req: &mut Request) -> IronResult<Response> {

match match_version(&conn, &name, req_version).and_then(|m| m.assume_exact()) {
Some(MatchSemver::Exact((version, _))) => {
let details = CrateDetails::new(&conn, &name, &version);
let details = cexpect!(req, CrateDetails::new(&conn, &name, &version));

CrateDetailsPage { details }.into_response(req)
}
Expand Down
8 changes: 4 additions & 4 deletions templates/crate/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<li class="pure-menu-item">
<a href="/crate/{{ dep[0] }}/{{ dep[1] }}" class="pure-menu-link">
{{ dep[0] }} {{ dep[1] }}
<i class="dependencies {{ dep[2] }}">{{ dep[2] }}</i>
<i class="dependencies {{ dep[2] | default(value='') }}">{{ dep[2] | default(value="") }}</i>
</a>
</li>
{%- endfor -%}
Expand Down Expand Up @@ -140,15 +140,15 @@

{# If there's not a readme then attempt to display the long description #}
{%- elif details.rustdoc -%}
{{ details.rustdoc }}
{{ details.rustdoc | safe }}
{%- endif -%}

{# If the build failed, the release isn't yanked and the release is a library #}
{%- else -%}
{# Display a warning telling the user we failed to build the docs #}
<div class="warning">
docs.rs failed to build {{ details.name }}-{{ details.version }}<br>Please check the
<a href="/crate/{{ details.name }}/{{ details.version }}/builds">build logs</a> and, if you believe this is
<a href="/crate/{{ details.name }}/{{ details.version }}/builds">build logs</a> and, if you believe this is
docs.rs' fault, <a href="https://github.com/rust-lang/docs.rs/issues/new/choose">open an issue</a>.
</div>

Expand All @@ -157,7 +157,7 @@
<div class="info">
Visit the last successful build:
<a href="/crate/{{ details.name }}/{{ details.last_successful_build }}">
{{ details.name }}-{{ details.last_successful_build }}
{{ details.name }}-{{ details.last_successful_build }}
</a>
</div>
{%- endif -%}
Expand Down
2 changes: 1 addition & 1 deletion templates/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
</a>

{# If the release failed to build, display a warning #}
{%- elif release.build_status -%}
{%- elif not release.build_status -%}
<a href="{{ release_url }}" class="pure-menu-link warn" title="docs.rs failed to build {{ release_name }}">
<i class="fa fa-fw fa-warning"></i> {{ release.version }}
</a>
Expand Down
2 changes: 1 addition & 1 deletion templates/rustdoc/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<li class="pure-menu-item">
<a href="/{{ dep[0] }}/{{ dep[1] }}" class="pure-menu-link">
{{ dep[0] }} {{ dep[1] }}
<i class="dependencies {{ dep[2] }}">{{ dep[2] }}</i>
<i class="dependencies {{ dep[2] | default(value='') }}">{{ dep[2] | default(value="") }}</i>
</a>
</li>
{%- endfor -%}
Expand Down
8 changes: 1 addition & 7 deletions templates/rustdoc/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<link rel="stylesheet" href="/style.css?{{ docsrs_version() | slugify }}" type="text/css" media="all" />
<link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Docs.rs">

{# Highlight.js CSS #}
{{ macros::highlight_css() }}

<title>{{ macros::doc_title(name=krate.name, version=krate.version) }}</title>
</head>

Expand Down Expand Up @@ -50,7 +47,4 @@
}
</script>

{# Highlight.js JavaScript #}
{{ macros::highlight_js(languages=["rust", "ini"]) }}

</html>
</html>

0 comments on commit 6b74ba1

Please sign in to comment.