Link commit on requests list to github

This commit is contained in:
Piotr Sarnacki 2014-05-08 14:34:05 +02:00
parent 57edf811b7
commit 1a0d004aeb
4 changed files with 21 additions and 2 deletions

View File

@ -309,6 +309,15 @@ Ember.registerBoundHelper 'capitalize', (value, options) ->
else
''
Ember.Handlebars.helper('githubCommitLink', (slug, commitSha) ->
return '' unless commitSha
sha = Handlebars.Utils.escapeExpression Travis.Helpers.formatCommit(commitSha)
return sha unless slug
url = Handlebars.Utils.escapeExpression Travis.Urls.githubCommit(slug, sha)
safe '<a class="github-link only-on-hover" href="' + url + '">' + sha + '</a>'
)
Ember.registerBoundHelper 'formatTime', (value, options) ->
safe Travis.Helpers.timeAgoInWords(value) || '-'

View File

@ -14,7 +14,7 @@ require 'travis/model'
pullRequestTitle: Ember.attr('string')
pullRequestNumber: Ember.attr(Number)
repo: Ember.belongsTo('Travis.Request', key: 'repository_id')
repo: Ember.belongsTo('Travis.Repo', key: 'repository_id')
commit: Ember.belongsTo('Travis.Commit', key: 'commit_id')
build: Ember.belongsTo('Travis.Build', key: 'build_id')

View File

@ -17,7 +17,7 @@
<span class="status"></span>
{{request.id}}
</td>
<td>{{formatSha request.commit.sha}}</td>
<td>{{githubCommitLink request.repo.slug request.commit.sha}}</td>
<td>
{{#if build}}
{{#link-to "build" build}}#{{build.number}}{{/link-to}}

View File

@ -21,3 +21,13 @@ ul
li
padding: 0
.github-link
background: transparent url(/images/icons/github.png) center right no-repeat
background-size: 12px
opacity: 1
padding-right: 16px
&.only-on-hover
background-image: none
&.only-on-hover:hover
background-image: url(/images/icons/github.png)