Add stats view and fix connectLayout

This commit is contained in:
Piotr Sarnacki 2013-02-20 01:01:03 +01:00
parent 0b001acfaf
commit 9bf2cb1078
4 changed files with 31 additions and 15 deletions

View File

@ -5,7 +5,14 @@ Travis.Controller = Em.Controller.extend()
Travis.TopController = Em.Controller.extend
userBinding: 'Travis.app.currentUser'
Travis.ApplicationController = Em.Controller.extend()
Travis.ApplicationController = Em.Controller.extend
templateName: 'layouts/home'
connectLayout: (name) ->
name = "layouts/#{name}"
if @get('templateName') != name
@set('templateName', name)
Travis.MainController = Em.Controller.extend()
Travis.StatsLayoutController = Em.Controller.extend()
Travis.ProfileLayoutController = Em.Controller.extend()

View File

@ -387,8 +387,11 @@ Travis.Router.map ->
@resource 'pullRequests', path: '/pull_requests'
@resource 'branches', path: '/branches'
@route 'stats', path: '/stats'
Travis.IndexCurrentRoute = Ember.Route.extend
renderTemplate: ->
@render 'repo'
@render 'build', outlet: 'pane', into: 'repo'
setupController: ->
@ -489,5 +492,16 @@ Travis.IndexRoute = Ember.Route.extend
@render 'flash', outlet: 'flash'
setupController: (controller)->
console.log 'setupController IndexRoute'
@container.lookup('controller:repos').activate()
@container.lookup('view:application').connectLayout 'home'
@container.lookup('controller:application').connectLayout 'home'
Travis.StatsRoute = Ember.Route.extend
renderTemplate: ->
$('body').attr('id', 'stats')
@render 'top', outlet: 'top'
@render 'stats'
setupController: ->
@container.lookup('controller:application').connectLayout('simple')

View File

@ -1,13 +1,13 @@
<a {{action showRoot href=true}}>
{{#linkTo index.current}}
<h1>Travis</h1>
</a>
{{/linkTo}}
<ul id="navigation">
<li class="home">
<a {{action showRoot href=true}}>{{t layouts.top.home}}</a>
{{#linkTo index.current}}{{t layouts.top.home}}{{/linkTo}}
</li>
<li class="stats">
<a {{action showStats href=true}}>{{t layouts.top.stats}}</a>
{{#linkTo stats}}{{t layouts.top.stats}}{{/linkTo}}
</li>
<li>
<a href="http://about.travis-ci.org/blog">{{t layouts.top.blog}}</a>

View File

@ -1,16 +1,11 @@
Travis.reopen
ApplicationView: Travis.View.extend
templateName: 'layouts/home'
templateName: (-> @get 'controller.templateName' ).property('controller.templateName')
classNames: ['application']
connectLayout: (name) ->
name = "layouts/#{name}"
if @get('templateName') != name
@set('templateName', name)
@rerender()
# popup: (event) ->
# console.log event
templateNameDidChange: (->
@rerender()
).observes('templateName')
click: ->
# TODO: this solves the case of closing menus and popups,