From 339991bfc382af3a6bbee453fde2ce74b7301026 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 18 Dec 2025 16:06:59 -0500 Subject: [PATCH] Add a link to browse crate source on docs.rs Don't show the link if there aren't any docs.rs builds as clicking on the link won't work then, but do still show the source link even if a non-docs.rs documentation link has been specified to enable review of the source exactly as crates.io serves it. --- app/components/crate-sidebar.gjs | 6 +- app/models/version.js | 26 +++- e2e/routes/crate/version/source-link.spec.ts | 113 ++++++++++++++++++ .../routes/crate/version/source-link-test.js | 87 ++++++++++++++ 4 files changed, 229 insertions(+), 3 deletions(-) create mode 100644 e2e/routes/crate/version/source-link.spec.ts create mode 100644 tests/routes/crate/version/source-link-test.js diff --git a/app/components/crate-sidebar.gjs b/app/components/crate-sidebar.gjs index 5de1723a116..2f691091bc0 100644 --- a/app/components/crate-sidebar.gjs +++ b/app/components/crate-sidebar.gjs @@ -162,7 +162,7 @@ export default class CrateSidebar extends Component { {{/unless}} - {{#if (or this.showHomepage @version.documentationLink @crate.repository)}} + {{#if (or this.showHomepage @version.documentationLink @version.sourceLink @crate.repository)}}