Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1355: Fix badges for crates with prerelease versions r=sgrif

Dashes are used to separate sections, and need to be escaped. I had
thought that `crate.max_version` never included prereleases, but I was
wrong.
  • Loading branch information
bors-voyager[bot] committed Apr 14, 2018
2 parents 78b408b + e36456a commit 783d0f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/components/crate-badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export default Component.extend({

tagName: 'span',

version: computed('crate.max_version', function() {
return this.get('crate.max_version').replace('-', '--');
}),

color: computed('crate.max_version', function() {
if (this.get('crate.max_version')[0] == '0') {
return 'orange';
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/crate-badge.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<img
src="https://img.shields.io/badge/crates.io-v{{ crate.max_version }}-{{ color }}.svg?longCache=true"
src="https://img.shields.io/badge/crates.io-v{{ version }}-{{ color }}.svg?longCache=true"
alt="{{ crate.max_version }}"
title="{{ crate.name }}’s current version badge"
data-test-version-badge>

0 comments on commit 783d0f2

Please sign in to comment.