Skip to content

Commit

Permalink
replace version with "latest" in the URL.
Browse files Browse the repository at this point in the history
  • Loading branch information
linyihai authored and syphar committed Oct 6, 2023
1 parent af91b40 commit 5fffeac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/web/releases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ mod tests {
)?;

assert_eq!(links.len(), 1);
assert_eq!(links[0], "/some_random_crate/1.0.0/some_random_crate/",);
assert_eq!(links[0], "/some_random_crate/latest/some_random_crate/",);
Ok(())
})
}
Expand Down Expand Up @@ -1097,7 +1097,7 @@ mod tests {
)?;

assert_eq!(links.len(), 1);
assert_eq!(links[0], "/some_random_crate/1.0.0/some_random_crate/");
assert_eq!(links[0], "/some_random_crate/latest/some_random_crate/");
Ok(())
})
}
Expand Down Expand Up @@ -1157,8 +1157,8 @@ mod tests {
// might not have it yet, or the doc-build might be in progress.
// * ranking/order from crates.io result is preserved
// * version used is the highest semver following our own "latest version" logic
assert_eq!(links[0], "/some_random_crate/2.0.0/some_random_crate/");
assert_eq!(links[1], "/and_another_one/0.0.1/and_another_one/");
assert_eq!(links[0], "/some_random_crate/latest/some_random_crate/");
assert_eq!(links[1], "/and_another_one/latest/and_another_one/");
Ok(())
})
}
Expand Down
9 changes: 6 additions & 3 deletions templates/releases/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@
<ul>
{# TODO: If there are no releases, then display a message that says so #}
{%- for release in releases -%}
{%- set release_version = release.version -%}
{%- if release_type == "search" -%}
{%- set release_version = "latest" -%}
{%- endif -%}
{%- if release.rustdoc_status -%}
{% set link = "/" ~ release.name ~ "/" ~ release.version ~ "/" ~ release.target_name ~ "/" -%}
{% set link = "/" ~ release.name ~ "/" ~ release_version ~ "/" ~ release.target_name ~ "/" -%}
{%- else -%}
{% set link = "/crate/" ~ release.name ~ "/" ~ release.version -%}
{% set link = "/crate/" ~ release.name ~ "/" ~ release_version -%}
{%- endif -%}

<li>
<a href="{{ link | safe }}" class="release">
<div class="pure-g">
Expand Down

0 comments on commit 5fffeac

Please sign in to comment.