Fix CCTray URL

This commit is contained in:
Piotr Sarnacki 2015-03-23 11:52:10 +01:00
parent 6540f3ac5b
commit 455e758653
2 changed files with 12 additions and 7 deletions

View File

@ -28,8 +28,8 @@ podStatusImage = ( (url, slug, branch) ->
"=for HTML <a href=\"#{url}\"><img src=\"#{statusImageUrl(slug, branch)}\"></a>"
)
ccxmlStatusUrl = ( (slug) ->
ccXmlUrl(slug)
ccxmlStatusUrl = ( (slug, branch) ->
ccXmlUrl(slug, branch)
)
format = (version, slug, branch) ->
@ -43,7 +43,7 @@ format = (version, slug, branch) ->
when 'AsciiDoc' then asciidocStatusImage(url, slug, branch)
when 'Rst' then rstStatusImage(url, slug, branch)
when 'Pod' then podStatusImage(url, slug, branch)
when 'CCTray' then ccxmlStatusUrl(url, slug, branch)
when 'CCTray' then ccxmlStatusUrl(slug, branch)
`export default format`

View File

@ -28,12 +28,17 @@ statusImage = (slug, branch) ->
else
"#{location.protocol}//#{location.host}/#{slug}.svg" + if branch then "?branch=#{encodeURIComponent(branch)}" else ''
ccXml = (slug) ->
ccXml = (slug, branch) ->
url = "##{config.apiEndpoint}/repos/#{slug}/cc.xml"
if branch
url = "#{url}?branch=#{branch}"
if config.pro
delimiter = if url.indexOf('?') == -1 then '?' else '&'
token = Travis.__container__.lookup('controller:currentUser').get('token')
"##{config.apiEndpoint}/repos/#{slug}/cc.xml?token=#{token}"
else
"#{config.apiEndpoint}/repos/#{slug}/cc.xml"
url = "#{url}#{delimiter}token=#{token}"
url
email = (email) ->
"mailto:#{email}"