Show pull request number on the list

This commit is contained in:
Piotr Sarnacki 2013-01-14 23:42:29 +01:00
parent 7c97317df6
commit 6fb15c4a97
5 changed files with 37 additions and 12 deletions

View File

@ -17,6 +17,9 @@
job: (slug, id) ->
"/#{slug}/jobs/#{id}"
githubPullRequest: (slug, pullRequestNumber) ->
"http://github.com/#{slug}/pull/#{pullRequestNumber}"
githubCommit: (slug, sha) ->
"http://github.com/#{slug}/commit/#{sha}"

View File

@ -1,14 +1,15 @@
require 'travis/model'
@Travis.Commit = Travis.Model.extend
buildId: DS.attr('number')
sha: DS.attr('string')
branch: DS.attr('string')
message: DS.attr('string')
compareUrl: DS.attr('string')
authorName: DS.attr('string')
authorEmail: DS.attr('string')
committerName: DS.attr('string')
committerEmail: DS.attr('string')
buildId: DS.attr('number')
sha: DS.attr('string')
branch: DS.attr('string')
message: DS.attr('string')
compareUrl: DS.attr('string')
authorName: DS.attr('string')
authorEmail: DS.attr('string')
committerName: DS.attr('string')
committerEmail: DS.attr('string')
pullRequestNumber: DS.attr('number')
build: DS.belongsTo('Travis.Build', key: 'buildId')

View File

@ -68,8 +68,6 @@ Travis.Store = DS.Store.extend
{ id: id, clientId: clientId }
receive: (event, data) ->
return if event == 'worker:added' || event == 'worker:removed'
[name, type] = event.split(':')
mappings = @adapter.get('mappings')

View File

@ -4,7 +4,14 @@
<tr>
<th>{{t builds.name}}</th>
<th>{{t builds.message}}</th>
<th>{{t builds.commit}}</th>
<th>
{{t builds.commit}}
</th>
{{#if view.isPullRequestsList}}
<th>
{{t builds.pr}}
</th>
{{/if}}
<th>{{t builds.duration}}</th>
<th>{{t builds.finished_at}}</th>
</tr>
@ -29,6 +36,13 @@
{{formatCommit commit}}
</a>
</td>
{{#if commit.pullRequestNumber}}
<td>
<a {{bindAttr href="view.urlGithubPullRequest"}}>
#{{commit.pullRequestNumber}}
</a>
</td>
{{/if}}
<td class="duration" {{bindAttr title="duration"}}>
{{formatDuration duration}}
</td>

View File

@ -3,6 +3,11 @@
templateName: 'builds/list'
buildsBinding: 'controller.builds'
isPullRequestsList: (->
console.log @get('controller.tab')
@get('controller.tab') == 'pull_requests'
).property('controller.tab')
showMore: ->
id = @get('controller.repo.id')
number = @get('builds.lastObject.number')
@ -43,6 +48,10 @@
Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha'))
).property('repo.slug', 'commit.sha')
urlGithubPullRequest: (->
Travis.Urls.githubPullRequest(@get('repo.slug'), @get('commit.pullRequestNumber'))
).property('repo.slug', 'commit.pullRequestNumber')
BuildView: Travis.View.extend
templateName: 'builds/show'
elementId: 'build'