Show landing page before signin in
This commit is contained in:
parent
53b2f6ca0e
commit
b30492296c
|
@ -50,14 +50,10 @@ Controller = Ember.ArrayController.extend
|
||||||
Visibility.every @config.intervals.updateTimes, @updateTimes.bind(this)
|
Visibility.every @config.intervals.updateTimes, @updateTimes.bind(this)
|
||||||
|
|
||||||
recentRepos: (->
|
recentRepos: (->
|
||||||
Ember.ArrayProxy.extend(
|
# I return an empty array here, because we're removing left sidebar, but
|
||||||
isLoadedBinding: 'repos.isLoaded'
|
# I don't want to refactor too much code (it will be all changed anyway
|
||||||
repos: Repo.withLastBuild(@store)
|
# when we switch to new dashboard)
|
||||||
sorted: Ember.computed.sort('repos', 'sortedReposKeys')
|
[]
|
||||||
content: limit('sorted', 'limit')
|
|
||||||
sortedReposKeys: ['sortOrder:asc']
|
|
||||||
limit: 30
|
|
||||||
).create()
|
|
||||||
).property()
|
).property()
|
||||||
|
|
||||||
updateTimes: ->
|
updateTimes: ->
|
||||||
|
|
|
@ -3,8 +3,26 @@
|
||||||
`import Location from 'travis/utils/location'`
|
`import Location from 'travis/utils/location'`
|
||||||
|
|
||||||
Router = Ember.Router.extend
|
Router = Ember.Router.extend
|
||||||
# TODO: we should use TravisLocation here
|
location: (->
|
||||||
location: if Ember.testing then 'none' else 'travis'
|
if Ember.testing
|
||||||
|
'none'
|
||||||
|
else
|
||||||
|
# this is needed, because in the location
|
||||||
|
# we need to decide if repositories or home needs
|
||||||
|
# to be displayed, based on the current login status
|
||||||
|
#
|
||||||
|
# we should probably think about a more general way to
|
||||||
|
# do this, location should not know about auth status
|
||||||
|
Location.create(auth: @container.lookup('auth:main'))
|
||||||
|
).property()
|
||||||
|
|
||||||
|
# TODO: this is needed, because in the original version
|
||||||
|
# the router tries to run `this.location`, which fails
|
||||||
|
# with computed properties. It can be removed once this is
|
||||||
|
# changed in Ember.js
|
||||||
|
generate: ->
|
||||||
|
url = this.router.generate.apply(this.router, arguments)
|
||||||
|
return this.get('location').formatURL(url)
|
||||||
|
|
||||||
handleURL: (url) ->
|
handleURL: (url) ->
|
||||||
url = url.replace(/#.*?$/, '')
|
url = url.replace(/#.*?$/, '')
|
||||||
|
|
|
@ -51,6 +51,6 @@ Route = TravisRoute.extend BuildFaviconMixin,
|
||||||
if @get('config').pro
|
if @get('config').pro
|
||||||
@transitionTo('auth')
|
@transitionTo('auth')
|
||||||
else
|
else
|
||||||
@transitionTo('main')
|
@transitionTo('home')
|
||||||
|
|
||||||
`export default Route`
|
`export default Route`
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
||||||
<header id="top" class="top">
|
<header id="top" class="top">
|
||||||
{{render "top"}}
|
{{render "top"}}
|
||||||
</header>
|
</header>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside id="left">
|
<aside id="left" {{bind-attr class="auth.signedIn::hidden"}}>
|
||||||
{{outlet "left"}}
|
{{outlet "left"}}
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,29 @@
|
||||||
`import Ember from 'ember'`
|
`import Ember from 'ember'`
|
||||||
|
|
||||||
Location = Ember.HistoryLocation.extend
|
Location = Ember.HistoryLocation.extend
|
||||||
|
init: ->
|
||||||
|
@_super.apply this, arguments
|
||||||
|
|
||||||
|
if auth = @get('auth')
|
||||||
|
# location's getURL is first called before we even
|
||||||
|
# get to routes, so autoSignIn won't be called in
|
||||||
|
# such case
|
||||||
|
auth.autoSignIn() unless auth.get('signedIn')
|
||||||
|
|
||||||
getURL: ->
|
getURL: ->
|
||||||
location = @get('location')
|
url = this._super.apply(this, arguments)
|
||||||
location.pathname + location.search + location.hash
|
if location.pathname == '/'
|
||||||
|
if @get('auth.signedIn')
|
||||||
|
return '/repositories'
|
||||||
|
else
|
||||||
|
return '/home'
|
||||||
|
|
||||||
|
url
|
||||||
|
|
||||||
|
formatURL: (logicalPath) ->
|
||||||
|
if logicalPath == '/repositories' || logicalPath == '/home'
|
||||||
|
'/'
|
||||||
|
else
|
||||||
|
@_super.apply this, arguments
|
||||||
|
|
||||||
`export default Location`
|
`export default Location`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user