Redirect to getting started page if user has no repositories
This commit is contained in:
parent
56422df915
commit
704bd9434e
|
@ -15,6 +15,13 @@ Travis.ReposController = Ember.ArrayController.extend
|
|||
@activate('recent')
|
||||
).observes('currentUser.id')
|
||||
|
||||
tabOrIsLoadedDidChange: (->
|
||||
if @get('tab') == 'owned' && @get('isLoaded') && @get('length') == 0 && !@get('gettingStartedLoaded')
|
||||
@set('gettingStartedLoaded', true)
|
||||
|
||||
@container.lookup('router:main').transitionTo('getting_started')
|
||||
).observes('isLoaded', 'tab')
|
||||
|
||||
isLoadedBinding: 'content.isLoaded'
|
||||
needs: ['currentUser', 'repo']
|
||||
currentUserBinding: 'controllers.currentUser'
|
||||
|
|
|
@ -103,6 +103,7 @@ Travis.Router.map ->
|
|||
@resource 'pullRequests', path: '/pull_requests'
|
||||
@resource 'branches', path: '/branches'
|
||||
|
||||
@route 'getting_started'
|
||||
@route 'stats', path: '/stats'
|
||||
@route 'auth', path: '/auth'
|
||||
@route 'notFound', path: '/not-found'
|
||||
|
@ -140,6 +141,16 @@ Travis.SetupLastBuild = Ember.Mixin.create
|
|||
build = @controllerFor('repo').get('repo.lastBuild')
|
||||
@controllerFor('build').set('build', build)
|
||||
|
||||
Travis.GettingStartedRoute = Ember.Route.extend
|
||||
setupController: ->
|
||||
$('body').attr('id', 'getting-started')
|
||||
@controllerFor('application').connectLayout('simple')
|
||||
@_super.apply(this, arguments)
|
||||
|
||||
renderTemplate: ->
|
||||
@render 'top', outlet: 'top'
|
||||
@_super.apply(this, arguments)
|
||||
|
||||
Travis.IndexCurrentRoute = Ember.Route.extend Travis.DontSetupModelForControllerMixin, Travis.SetupLastBuild,
|
||||
renderTemplate: ->
|
||||
@render 'repo'
|
||||
|
|
3
assets/scripts/app/templates/getting_started.hbs
Normal file
3
assets/scripts/app/templates/getting_started.hbs
Normal file
|
@ -0,0 +1,3 @@
|
|||
It looks like you don't have any repositories set up, you can do that on the {{#linkTo "profile.index"}}profile page{{/linkTo}}.
|
||||
|
||||
More instructions....
|
|
@ -5,30 +5,34 @@
|
|||
{{view Travis.ReposListTabsView}}
|
||||
|
||||
<div class="tab">
|
||||
{{#collection Travis.ReposListView contentBinding="this"}}
|
||||
{{#with view.repo}}
|
||||
<div class="slug-and-status">
|
||||
<span class="status"></span>
|
||||
{{#if slug}}
|
||||
{{#linkTo repo this class="slug"}}{{slug}}{{/linkTo}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#with lastBuildHash}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo build repo id class="last_build"}}{{number}}{{/linkTo}}
|
||||
{{/if}}
|
||||
{{#if isLoaded}}
|
||||
{{#collection Travis.ReposListView contentBinding="this"}}
|
||||
{{#with view.repo}}
|
||||
<div class="slug-and-status">
|
||||
<span class="status"></span>
|
||||
{{#if slug}}
|
||||
{{#linkTo repo this class="slug"}}{{slug}}{{/linkTo}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#with lastBuildHash}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo build repo id class="last_build"}}{{number}}{{/linkTo}}
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
|
||||
<p class="summary">
|
||||
<span class="duration_label">{{t repositories.duration}}:</span>
|
||||
<abbr class="duration" {{bindAttr title="lastBuildStartedAt"}}>{{formatDuration lastBuildDuration}}</abbr>,
|
||||
<span class="finished_at_label">{{t repositories.finished_at}}:</span>
|
||||
<abbr class="finished_at timeago" {{bindAttr title="lastBuildFinishedAt"}}>{{formatTime lastBuildFinishedAt}}</abbr>
|
||||
</p>
|
||||
|
||||
<div class="indicator"><span></span></div>
|
||||
{{/with}}
|
||||
|
||||
<p class="summary">
|
||||
<span class="duration_label">{{t repositories.duration}}:</span>
|
||||
<abbr class="duration" {{bindAttr title="lastBuildStartedAt"}}>{{formatDuration lastBuildDuration}}</abbr>,
|
||||
<span class="finished_at_label">{{t repositories.finished_at}}:</span>
|
||||
<abbr class="finished_at timeago" {{bindAttr title="lastBuildFinishedAt"}}>{{formatTime lastBuildFinishedAt}}</abbr>
|
||||
</p>
|
||||
|
||||
<div class="indicator"><span></span></div>
|
||||
{{/with}}
|
||||
{{else}}
|
||||
<p class="empty">You don't have any repos set up on Travis CI</p>
|
||||
{{/collection}}
|
||||
{{else}}
|
||||
<p class="empty"></p>
|
||||
{{/collection}}
|
||||
<div class="loading"><span>Loading</span></div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{{outlet pane}}
|
||||
</div>
|
||||
{{else}}
|
||||
<span>Loading</span>
|
||||
<div class="loading"><span>Loading</span></div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
6
assets/styles/getting_started.sass
Normal file
6
assets/styles/getting_started.sass
Normal file
|
@ -0,0 +1,6 @@
|
|||
#getting-started
|
||||
a
|
||||
font-weight: bold
|
||||
|
||||
&:hover
|
||||
text-decoration: underline
|
|
@ -77,10 +77,10 @@
|
|||
&.selected .indicator
|
||||
display: block
|
||||
|
||||
.loading
|
||||
padding: 15px 25px 15px 30px
|
||||
background-color: $color-bg-list-odd
|
||||
background-image: none
|
||||
#left .loading
|
||||
padding: 15px 25px 15px 30px
|
||||
background-color: $color-bg-list-odd
|
||||
background-image: none
|
||||
|
||||
#accounts
|
||||
li
|
||||
|
|
Loading…
Reference in New Issue
Block a user