Skip to content

Commit c025fbb

Browse files
committed
Fix auto-documentation link not being updated on version change
As we edit the live model, the fetchCrateDocumentation was not being called as the documentation property of the model was not undefined annymore. Bonus feature: Any crate that has a docs.rs link as documentation automatically gets versioning on it
1 parent bb622ce commit c025fbb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/routes/crate/version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export default Ember.Route.extend({
88

99
model(params) {
1010
const requestedVersion = params.version_num === 'all' ? '' : params.version_num;
11-
1211
const crate = this.modelFor('crate');
1312
const controller = this.controllerFor(this.routeName);
1413
const maxVersion = crate.get('max_version');
@@ -36,7 +35,8 @@ export default Ember.Route.extend({
3635
};
3736

3837
const fetchCrateDocumentation = () => {
39-
if (!crate.get('documentation')) {
38+
if (!crate.get('documentation') ||
39+
crate.get('documentation').substr(0, 16) === 'https://docs.rs/') {
4040
let crateName = crate.get('name');
4141
let crateVersion = params.version_num;
4242
ajax(`https://docs.rs/crate/${crateName}/${crateVersion}/builds.json`)

0 commit comments

Comments
 (0)