Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/components/badge-appveyor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@ export default Component.extend({
tagName: 'span',
classNames: ['badge'],

id: alias('badge.attributes.id'),
repository: alias('badge.attributes.repository'),

imageUrl: computed('badge.attributes.id', function() {
let id = this.get('badge.attributes.id');
let branch = this.get('branch');
if (id !== undefined && id !== null) {
return `https://ci.appveyor.com/api/projects/status/${id}/branch/${branch}?svg=true`;
} else {
let service = this.get('service');
let repository = this.get('repository');

return `https://ci.appveyor.com/api/projects/status/${service}/${repository}?svg=true&branch=${branch}`;
}
}),

branch: computed('badge.attributes.branch', function() {
return this.get('badge.attributes.branch') || 'master';
}),
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/badge-appveyor.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<a href="https://ci.appveyor.com/project/{{ repository }}">
<img
src="https://ci.appveyor.com/api/projects/status/{{ service }}/{{ repository }}?svg=true&branch={{ branch }}"
src="{{ imageUrl }}"
alt="{{ text }}"
width="106"
height="20"
Expand Down
1 change: 1 addition & 0 deletions src/badge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub enum Badge {
},
Appveyor {
repository: String,
id: Option<String>,
branch: Option<String>,
service: Option<String>,
},
Expand Down
1 change: 1 addition & 0 deletions src/tests/badge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn set_up() -> (Arc<App>, Crate, BadgeRef) {

let appveyor = Badge::Appveyor {
service: Some(String::from("github")),
id: None,
branch: None,
repository: String::from("rust-lang/cargo"),
};
Expand Down