Show appropriate message when the repository has no builds

This commit is contained in:
Piotr Sarnacki 2013-03-11 20:11:43 +01:00
parent 8fab8448c2
commit 63559f4c4c
6 changed files with 61 additions and 55 deletions

View File

@ -8,8 +8,8 @@ Travis.BuildController = Ember.Controller.extend
currentItemBinding: 'build' currentItemBinding: 'build'
loading: (-> loading: (->
!@get('build.isLoaded') @get('build.isLoading')
).property('build.isLoaded') ).property('build.isLoading')
urlGithubCommit: (-> urlGithubCommit: (->
Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha')) Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha'))

View File

@ -3,9 +3,9 @@ Travis.RepoController = Travis.Controller.extend
needs: ['repos', 'currentUser'] needs: ['repos', 'currentUser']
currentUserBinding: 'controllers.currentUser' currentUserBinding: 'controllers.currentUser'
isError: (-> @get('content.isError') ).property('content.isError') isError: (-> @get('repo.isError') ).property('repo.isError')
slug: (-> @get('content.slug') ).property('content.slug') slug: (-> @get('repo.slug') ).property('repo.slug')
isLoading: (-> @get('content.isLoading') ).property('content.isLoading') isLoading: (-> @get('repo.isLoading') ).property('repo.isLoading')
init: -> init: ->
@_super.apply this, arguments @_super.apply this, arguments

View File

@ -20,7 +20,7 @@ Travis.ReposController = Ember.ArrayController.extend
Travis.LimitedArray.create Travis.LimitedArray.create
content: Em.ArrayProxy.extend(Em.SortableMixin).create( content: Em.ArrayProxy.extend(Em.SortableMixin).create(
sortProperties: ['sortOrder'] sortProperties: ['sortOrder']
content: Travis.Repo.find() content: Travis.Repo.withLastBuild()
isLoadedBinding: 'content.isLoaded' isLoadedBinding: 'content.isLoaded'
) )
limit: 30 limit: 30

View File

@ -116,6 +116,9 @@ require 'travis/model'
search: (query) -> search: (query) ->
@find(search: query, orderBy: 'name') @find(search: query, orderBy: 'name')
withLastBuild: ->
@filter( (repo) -> repo.get('lastBuildId') )
bySlug: (slug) -> bySlug: (slug) ->
repo = $.select(@find().toArray(), (repo) -> repo.get('slug') == slug) repo = $.select(@find().toArray(), (repo) -> repo.get('slug') == slug)
if repo.length > 0 then repo else @find(slug: slug) if repo.length > 0 then repo else @find(slug: slug)

View File

@ -1,6 +1,7 @@
{{#if loading}} {{#if loading}}
<span>Loading</span> <span>Loading</span>
{{else}} {{else}}
{{#if build}}
<dl id="summary"> <dl id="summary">
<div class="left"> <div class="left">
<dt>{{t builds.name}}</dt> <dt>{{t builds.name}}</dt>
@ -54,4 +55,7 @@
{{else}} {{else}}
{{view Travis.LogView jobBinding="job"}} {{view Travis.LogView jobBinding="job"}}
{{/if}} {{/if}}
{{else}}
There are no builds for this repository.
{{/if}}
{{/if}} {{/if}}

View File

@ -2,7 +2,6 @@ Travis.reopen
RepoView: Travis.View.extend RepoView: Travis.View.extend
templateName: 'repos/show' templateName: 'repos/show'
repoBinding: 'controllers.repo'
reposBinding: 'controllers.repos' reposBinding: 'controllers.repos'
classNameBindings: ['controller.isLoading:loading'] classNameBindings: ['controller.isLoading:loading']