Rename IndexRoute to MainRoute

This commit is contained in:
Piotr Sarnacki 2015-01-14 13:11:36 +01:00
parent 56e19df5f2
commit 5c280001d3
8 changed files with 22 additions and 24 deletions

View File

@ -75,7 +75,7 @@ Travis.ReposController = Ember.ArrayController.extend
searchFor: (phrase) -> searchFor: (phrase) ->
Ember.run.cancel(@searchLater) if @searchLater Ember.run.cancel(@searchLater) if @searchLater
@searchLater = Ember.run.later(this, (-> @searchLater = Ember.run.later(this, (->
@transitionTo('index.search', phrase) @transitionTo('main.search', phrase)
), 500) ), 500)
noReposMessage: (-> noReposMessage: (->

View File

@ -57,16 +57,16 @@ Travis.ApplicationRoute = Travis.Route.extend
@auth.set('afterSignInTransition', null) @auth.set('afterSignInTransition', null)
transition.retry() transition.retry()
else else
@transitionTo('index') @transitionTo('main')
afterSignOut: -> afterSignOut: ->
if Travis.config.pro if Travis.config.pro
@transitionTo('auth') @transitionTo('auth')
else else
@transitionTo('index') @transitionTo('main')
Travis.Router.map -> Travis.Router.map ->
@resource 'index', path: '/', -> @resource 'main', path: '/', ->
@resource 'getting_started' @resource 'getting_started'
@route 'recent' @route 'recent'
@route 'repositories' @route 'repositories'
@ -170,7 +170,7 @@ Travis.InsufficientOauthPermissionsRoute = Travis.SimpleLayoutRoute.extend
existingUser = document.location.hash.match(/#existing[_-]user/) existingUser = document.location.hash.match(/#existing[_-]user/)
controller.set('existingUser', existingUser) controller.set('existingUser', existingUser)
Travis.IndexTabRoute = Travis.Route.extend Travis.MainTabRoute = Travis.Route.extend
renderTemplate: -> renderTemplate: ->
@render 'repo' @render 'repo'
@render 'build', into: 'repo' @render 'build', into: 'repo'
@ -195,20 +195,20 @@ Travis.IndexTabRoute = Travis.Route.extend
redirectToGettingStarted: -> redirectToGettingStarted: ->
@transitionTo('getting_started') @transitionTo('getting_started')
Travis.IndexMyRepositoriesRoute = Travis.Route.extend Travis.MainMyRepositoriesRoute = Travis.Route.extend
redirect: -> redirect: ->
@transitionTo("index.repositories") @transitionTo("main.repositories")
Travis.IndexRepositoriesRoute = Travis.IndexTabRoute.extend Travis.MainRepositoriesRoute = Travis.MainTabRoute.extend
needsAuth: true needsAuth: true
reposTabName: 'owned' reposTabName: 'owned'
afterModel: -> afterModel: ->
@controllerFor('repos').possiblyRedirectToGettingStartedPage() @controllerFor('repos').possiblyRedirectToGettingStartedPage()
Travis.IndexRecentRoute = Travis.IndexTabRoute.extend Travis.MainRecentRoute = Travis.MainTabRoute.extend
reposTabName: 'recent' reposTabName: 'recent'
Travis.IndexSearchRoute = Travis.IndexTabRoute.extend Travis.MainSearchRoute = Travis.MainTabRoute.extend
renderTemplate: -> renderTemplate: ->
@render 'repo' @render 'repo'
@render 'build', into: 'repo' @render 'build', into: 'repo'
@ -329,7 +329,7 @@ Travis.RepoIndexRoute = Travis.Route.extend
Travis.RepoRoute = Travis.Route.extend Travis.RepoRoute = Travis.Route.extend
renderTemplate: -> renderTemplate: ->
@render 'repo' @render 'repo', into: 'main'
setupController: (controller, model) -> setupController: (controller, model) ->
# TODO: if repo is just a data hash with id and slug load it # TODO: if repo is just a data hash with id and slug load it
@ -352,28 +352,26 @@ Travis.RepoRoute = Travis.Route.extend
actions: actions:
error: (error) -> error: (error) ->
# if error throwed has a slug (ie. it was probably repo not found) # if error throwed has a slug (ie. it was probably repo not found)
# set the slug on index.error controller to allow to properly # set the slug on main.error controller to allow to properly
# display the repo information # display the repo information
if error.slug if error.slug
this.controllerFor('index.error').set('slug', error.slug) this.controllerFor('main.error').set('slug', error.slug)
# bubble to the top # bubble to the top
return true return true
# Obviously Index route should be renamed to something Travis.MainIndexRoute = Travis.Route.extend
# like "main" or "home"
Travis.IndexIndexRoute = Travis.Route.extend
redirect: -> redirect: ->
target = if @signedIn() then 'repositories' else 'recent' target = if @signedIn() then 'repositories' else 'recent'
@transitionTo("index.#{target}") @transitionTo("main.#{target}")
Travis.IndexRoute = Travis.Route.extend Travis.MainRoute = Travis.Route.extend
renderTemplate: -> renderTemplate: ->
$('body').attr('id', 'home') $('body').attr('id', 'home')
@_super.apply this, arguments @_super.apply this, arguments
@render 'repos', outlet: 'left', into: 'index' @render 'repos', outlet: 'left', into: 'main'
setupController: (controller)-> setupController: (controller)->
# TODO: this is redundant with repositories and recent routes # TODO: this is redundant with repositories and recent routes

View File

@ -1,4 +1,4 @@
{{#link-to "index"}} {{#link-to "main"}}
<div id="home"> <div id="home">
<h1>Travis</h1> <h1>Travis</h1>
</div> </div>
@ -6,7 +6,7 @@
<ul id="navigation"> <ul id="navigation">
<li class="home"> <li class="home">
{{#link-to "index"}}Home{{/link-to}} {{#link-to "main"}}Home{{/link-to}}
</li> </li>
<li> <li>
<a href="http://blog.travis-ci.com">Blog</a> <a href="http://blog.travis-ci.com">Blog</a>

View File

@ -1,11 +1,11 @@
<ul class="tabs"> <ul class="tabs">
<li id="tab_owned" {{bind-attr class="view.classOwned"}}> <li id="tab_owned" {{bind-attr class="view.classOwned"}}>
<h5>{{#link-to "index.repositories"}}My Repositories{{/link-to}}</h5> <h5>{{#link-to "main.repositories"}}My Repositories{{/link-to}}</h5>
</li> </li>
{{#unless config.pro}} {{#unless config.pro}}
<li id="tab_recent" {{bind-attr class="view.classRecent"}}> <li id="tab_recent" {{bind-attr class="view.classRecent"}}>
<h5>{{#link-to "index.recent"}}Recent{{/link-to}}</h5> <h5>{{#link-to "main.recent"}}Recent{{/link-to}}</h5>
</li> </li>
{{/unless}} {{/unless}}

View File

@ -28,7 +28,7 @@ Travis.NotFoundView = Ember.View.extend
$('.popup').removeClass('display') $('.popup').removeClass('display')
Travis.IndexView = Travis.View.extend Travis.MainView = Travis.View.extend
layoutName: 'layouts/home' layoutName: 'layouts/home'
classNames: ['application'] classNames: ['application']