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'
loading: (->
!@get('build.isLoaded')
).property('build.isLoaded')
@get('build.isLoading')
).property('build.isLoading')
urlGithubCommit: (->
Travis.Urls.githubCommit(@get('repo.slug'), @get('commit.sha'))

View File

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

View File

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

View File

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

View File

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

View File

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