travis-web/assets/scripts/app/views/build.coffee
2014-05-09 02:20:34 +02:00

67 lines
2.0 KiB
CoffeeScript

Travis.reopen
BuildsView: Travis.View.extend
templateName: 'builds/list'
buildsBinding: 'controller.builds'
isPullRequestsList: (->
@get('controller.tab') == 'pull_requests'
).property('controller.tab')
ShowMoreButton: Em.View.extend
tagName: 'button'
classNameBindings: ['isLoading', 'showMore']
showMore: true
attributeBindings: ['disabled']
isLoadingBinding: 'controller.isLoading'
template: Em.Handlebars.compile('{{view.label}}')
disabledBinding: 'isLoading'
label: (->
if @get('isLoading') then 'Loading' else 'Show more'
).property('isLoading')
click: ->
@get('controller').showMore()
BuildsItemView: Travis.View.extend
tagName: 'tr'
classNameBindings: ['color']
repoBinding: 'controller.repo'
buildBinding: 'context'
commitBinding: 'build.commit'
isPullRequestsList: ( -> @get('parentView.isPullRequestsList') ).property('parentView.isPullRequestsList')
color: (->
Travis.Helpers.colorForState(@get('build.state'))
).property('build.state')
urlGithubCommit: (->
Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha'))
).property('repo.slug', 'commit.sha')
urlGithubPullRequest: (->
Travis.Urls.githubPullRequest(@get('repo.slug'), @get('build.pullRequestNumber'))
).property('repo.slug', 'build.pullRequestNumber')
BuildView: Travis.View.extend
templateName: 'builds/show'
classNameBindings: ['color', 'loading']
buildBinding: 'controller.build'
commitBinding: 'build.commit'
urlCommitterGravatarImage: (->
Travis.Urls.gravatarImage(@get('commit.committerEmail'), 40)
).property('commit.committerEmail')
urlAuthorGravatarImage: (->
Travis.Urls.gravatarImage(@get('commit.authorEmail'), 40)
).property('commit.authorEmail')
loadingBinding: 'controller.loading'
color: (->
Travis.Helpers.colorForState(@get('build.state'))
).property('build.state')