Display repos with no builds, but which are active in 'My repositories'

When user activates a repository in the profile page, we now will
display this repository on the 'My Repositories' list. When user chooses
this repository, she will see an explenation why there is no builds and
what could be done to fix this.

Conflicts:
	assets/scripts/app/controllers.coffee
	assets/scripts/app/models/repo.coffee
	assets/scripts/app/templates/repos/list.hbs
This commit is contained in:
Piotr Sarnacki 2013-06-13 16:21:08 +02:00
parent 7363a1d7ef
commit fbed80f166
5 changed files with 24 additions and 8 deletions

View File

@ -48,6 +48,14 @@ Travis.FirstSyncController = Em.Controller.extend
isSyncing: Ember.computed.alias('user.isSyncing') isSyncing: Ember.computed.alias('user.isSyncing')
Travis.BuildNotFoundController = Em.Controller.extend
needs: ['repo', 'currentUser']
ownedAndActive: (->
if permissions = @get('controllers.currentUser.permissions')
if repo = @get('controllers.repo.repo')
repo.get('active') && permissions.contains(parseInt(repo.get('id')))
).property('controllers.repo.repo', 'controllers.currentUser.permissions')
require 'controllers/accounts' require 'controllers/accounts'
require 'controllers/build' require 'controllers/build'
require 'controllers/builds' require 'controllers/builds'

View File

@ -12,6 +12,7 @@ require 'travis/model'
lastBuildFinishedAt: Ember.attr('string') lastBuildFinishedAt: Ember.attr('string')
githubLanguage: Ember.attr('string') githubLanguage: Ember.attr('string')
_lastBuildDuration: Ember.attr(Number, key: 'last_build_duration') _lastBuildDuration: Ember.attr(Number, key: 'last_build_duration')
active: Ember.attr('boolean')
lastBuild: Ember.belongsTo('Travis.Build', key: 'last_build_id') lastBuild: Ember.belongsTo('Travis.Build', key: 'last_build_id')
@ -113,7 +114,7 @@ require 'travis/model'
@find(owner_name: login, orderBy: 'name') @find(owner_name: login, orderBy: 'name')
accessibleBy: (login) -> accessibleBy: (login) ->
@find(member: login, orderBy: 'name') @find(member: login, active: true)
search: (query) -> search: (query) ->
@find(search: query, orderBy: 'name') @find(search: query, orderBy: 'name')

View File

@ -125,7 +125,7 @@ Travis.SetupLastBuild = Ember.Mixin.create
repo = @controllerFor('repo').get('repo') repo = @controllerFor('repo').get('repo')
if repo && repo.get('isLoaded') && !repo.get('lastBuild') if repo && repo.get('isLoaded') && !repo.get('lastBuild')
Ember.run.next => Ember.run.next =>
@render('builds/not_found', outlet: 'pane', into: 'repo') @render('builds/not_found', outlet: 'pane', into: 'repo', controller: 'buildNotFound')
Travis.GettingStartedRoute = Ember.Route.extend Travis.GettingStartedRoute = Ember.Route.extend
setupController: -> setupController: ->

View File

@ -1 +1,5 @@
{{#if ownedAndActive}}
This repository is active, but there are no builds yet. Builds will appear here after you push new commits to the repository.
{{else}}
There are no builds for this repository. There are no builds for this repository.
{{/if}}

View File

@ -14,11 +14,14 @@
{{#linkTo "repo" this class="slug"}}{{slug}}{{/linkTo}} {{#linkTo "repo" this class="slug"}}{{slug}}{{/linkTo}}
{{/if}} {{/if}}
</div> </div>
{{#if lastBuild}}
{{#with lastBuildHash}} {{#with lastBuildHash}}
{{#if repo.slug}} {{#if repo.slug}}
{{#linkTo "build" repo id class="last_build"}}{{number}}{{/linkTo}} {{#linkTo "build" repo id class="last_build"}}{{number}}{{/linkTo}}
{{/if}} {{/if}}
{{/with}} {{/with}}
{{/if}}
<p class="summary"> <p class="summary">
<span class="duration-icon"></span><span class="duration_label">{{t repositories.duration}}:</span> <span class="duration-icon"></span><span class="duration_label">{{t repositories.duration}}:</span>