Plug proper layouts and links on profile view
This commit is contained in:
parent
1134028996
commit
0885cdf674
|
@ -43,12 +43,6 @@ Travis.reopen
|
||||||
|
|
||||||
signOut: ->
|
signOut: ->
|
||||||
@get('auth').signOut()
|
@get('auth').signOut()
|
||||||
@routes.route('')
|
|
||||||
|
|
||||||
render: (name, action, params) ->
|
|
||||||
layout = @connectLayout(name)
|
|
||||||
layout.activate(action, params || {})
|
|
||||||
$('body').attr('id', name)
|
|
||||||
|
|
||||||
receive: ->
|
receive: ->
|
||||||
@store.receive.apply(@store, arguments)
|
@store.receive.apply(@store, arguments)
|
||||||
|
|
|
@ -19,6 +19,9 @@ Travis.reopen
|
||||||
TopController: Em.Controller.extend
|
TopController: Em.Controller.extend
|
||||||
userBinding: 'Travis.app.currentUser'
|
userBinding: 'Travis.app.currentUser'
|
||||||
ApplicationController: Em.Controller.extend()
|
ApplicationController: Em.Controller.extend()
|
||||||
|
MainController: Em.Controller.extend()
|
||||||
|
StatsLayoutController: Em.Controller.extend()
|
||||||
|
ProfileLayoutController: Em.Controller.extend()
|
||||||
|
|
||||||
require 'controllers/accounts'
|
require 'controllers/accounts'
|
||||||
require 'controllers/builds'
|
require 'controllers/builds'
|
||||||
|
|
|
@ -2,6 +2,7 @@ Travis.AccountsController = Ember.ArrayController.extend
|
||||||
defaultTab: 'accounts'
|
defaultTab: 'accounts'
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
|
@_super()
|
||||||
@activate(@defaultTab)
|
@activate(@defaultTab)
|
||||||
|
|
||||||
activate: (tab, params) ->
|
activate: (tab, params) ->
|
||||||
|
@ -10,3 +11,6 @@ Travis.AccountsController = Ember.ArrayController.extend
|
||||||
|
|
||||||
viewAccounts: ->
|
viewAccounts: ->
|
||||||
@set('content', Travis.Account.filter())
|
@set('content', Travis.Account.filter())
|
||||||
|
|
||||||
|
findByLogin: (login) ->
|
||||||
|
@find (account) -> account.get('login') == 'login'
|
||||||
|
|
|
@ -1,5 +1 @@
|
||||||
Travis.HomeController = Travis.Controller.extend
|
Travis.HomeController = Travis.Controller.extend()
|
||||||
name: 'home'
|
|
||||||
|
|
||||||
activate: (action, params) ->
|
|
||||||
@repositoryController.activate(action, params)
|
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
Travis.ProfileController = Travis.Controller.extend
|
Travis.ProfileController = Travis.Controller.extend
|
||||||
name: 'profile'
|
name: 'profile'
|
||||||
userBinding: 'Travis.app.currentUser'
|
userBinding: 'Travis.app.currentUser'
|
||||||
|
accountsBinding: 'Travis.app.router.accountsController'
|
||||||
init: ->
|
|
||||||
@_super()
|
|
||||||
# @_super('top', 'accounts')
|
|
||||||
# @connectTop()
|
|
||||||
# @connectOutlet outletName: 'left', controller: @accountsController, viewClass: Travis.AccountsView
|
|
||||||
# @connectOutlet(outletName: 'main', controller: this, viewClass: Travis.ProfileView)
|
|
||||||
# @accounts = @accountsController.get('content')
|
|
||||||
|
|
||||||
account: (->
|
account: (->
|
||||||
login = @get('params.login') || Travis.app.get('currentUser.login')
|
login = @get('params.login') || Travis.app.get('currentUser.login')
|
||||||
@accounts.toArray().filter((account) -> account if account.get('login') == login)[0]
|
@get('accounts').filter((account) -> account if account.get('login') == login)[0]
|
||||||
).property('accounts.length', 'params.login')
|
).property('accounts.length', 'params.login')
|
||||||
|
|
||||||
activate: (action, params) ->
|
activate: (action, params) ->
|
||||||
|
|
|
@ -4,13 +4,16 @@ Travis.Router = Ember.Router.extend
|
||||||
initialState: 'loading'
|
initialState: 'loading'
|
||||||
|
|
||||||
goToRoot: Ember.Route.transitionTo('root.home.show')
|
goToRoot: Ember.Route.transitionTo('root.home.show')
|
||||||
goToStats: Ember.Route.transitionTo('root.home.stats')
|
goToStats: Ember.Route.transitionTo('root.stats')
|
||||||
showRepository: Ember.Route.transitionTo('root.home.repository.show')
|
showRepository: Ember.Route.transitionTo('root.home.repository.show')
|
||||||
showBuilds: Ember.Route.transitionTo('root.home.repository.builds.index')
|
showBuilds: Ember.Route.transitionTo('root.home.repository.builds.index')
|
||||||
showBuild: Ember.Route.transitionTo('root.home.repository.builds.show')
|
showBuild: Ember.Route.transitionTo('root.home.repository.builds.show')
|
||||||
showPullRequests: Ember.Route.transitionTo('root.home.repository.pullRequests')
|
showPullRequests: Ember.Route.transitionTo('root.home.repository.pullRequests')
|
||||||
showBranches: Ember.Route.transitionTo('root.home.repository.branches')
|
showBranches: Ember.Route.transitionTo('root.home.repository.branches')
|
||||||
showJob: Ember.Route.transitionTo('root.home.repository.job')
|
showJob: Ember.Route.transitionTo('root.home.repository.job')
|
||||||
|
showProfile: Ember.Route.transitionTo('root.profile')
|
||||||
|
showAccount: Ember.Route.transitionTo('root.profile.account')
|
||||||
|
showUserProfile: Ember.Route.transitionTo('root.profile.account.profile')
|
||||||
|
|
||||||
signedIn: ->
|
signedIn: ->
|
||||||
!!Travis.app.get('currentUser')
|
!!Travis.app.get('currentUser')
|
||||||
|
@ -56,25 +59,76 @@ Travis.Router = Ember.Router.extend
|
||||||
initialState: 'home'
|
initialState: 'home'
|
||||||
loading: Ember.State.extend()
|
loading: Ember.State.extend()
|
||||||
|
|
||||||
|
stats: Ember.Route.extend
|
||||||
|
route: '/stats'
|
||||||
|
connectOutlets: (router) ->
|
||||||
|
router.get('applicationController').connectOutlet 'statsLayout'
|
||||||
|
$('body').attr('id', 'stats')
|
||||||
|
router.get('statsLayoutController').connectOutlet 'top', 'top'
|
||||||
|
router.get('statsLayoutController').connectOutlet 'main', 'stats'
|
||||||
|
|
||||||
|
profile: Ember.Route.extend
|
||||||
|
initialState: 'index'
|
||||||
|
route: '/profile'
|
||||||
|
connectOutlets: (router) ->
|
||||||
|
router.get('applicationController').connectOutlet 'profileLayout'
|
||||||
|
$('body').attr('id', 'profile')
|
||||||
|
router.get('profileLayoutController').connectOutlet 'top', 'top'
|
||||||
|
router.get('profileLayoutController').connectOutlet 'left', 'accounts'
|
||||||
|
|
||||||
|
index: Ember.Route.extend
|
||||||
|
route: '/'
|
||||||
|
connectOutlets: (router) ->
|
||||||
|
router.get('profileLayoutController').connectOutlet 'main', 'profile'
|
||||||
|
router.get('profileController').activate 'hooks'
|
||||||
|
|
||||||
|
account: Ember.Route.extend
|
||||||
|
initialState: 'index'
|
||||||
|
route: '/:login'
|
||||||
|
|
||||||
|
connectOutlets: (router, account) ->
|
||||||
|
if account
|
||||||
|
params = { login: account.get('login') }
|
||||||
|
router.get('profileController').setParams(params)
|
||||||
|
else
|
||||||
|
router.send 'showProfile'
|
||||||
|
|
||||||
|
deserialize: (router, params) ->
|
||||||
|
router.get('accountsController').findByLogin(params.login)
|
||||||
|
|
||||||
|
serialize: (router, account) ->
|
||||||
|
if account
|
||||||
|
{ login: account.get('login') }
|
||||||
|
else
|
||||||
|
{}
|
||||||
|
|
||||||
|
index: Ember.Route.extend
|
||||||
|
route: '/'
|
||||||
|
connectOutlets: (router) ->
|
||||||
|
router.get('profileController').activate 'hooks'
|
||||||
|
|
||||||
|
profile: Ember.Route.extend
|
||||||
|
route: '/profile'
|
||||||
|
|
||||||
|
connectOutlets: (router) ->
|
||||||
|
router.get('profileController').activate 'user'
|
||||||
|
|
||||||
home: Ember.Route.extend
|
home: Ember.Route.extend
|
||||||
initialState: 'show'
|
initialState: 'show'
|
||||||
route: '/'
|
route: '/'
|
||||||
connectOutlets: (router) ->
|
connectOutlets: (router) ->
|
||||||
router.get('applicationController').connectOutlet 'left', 'repositories'
|
router.get('applicationController').connectOutlet 'home'
|
||||||
router.get('applicationController').connectOutlet 'right', 'sidebar'
|
$('body').attr('id', 'home')
|
||||||
router.get('applicationController').connectOutlet 'top', 'top'
|
router.get('homeController').connectOutlet 'left', 'repositories'
|
||||||
router.get('applicationController').connectOutlet 'main', 'repository'
|
router.get('homeController').connectOutlet 'right', 'sidebar'
|
||||||
|
router.get('homeController').connectOutlet 'top', 'top'
|
||||||
|
router.get('homeController').connectOutlet 'main', 'repository'
|
||||||
|
|
||||||
show: Ember.Route.extend
|
show: Ember.Route.extend
|
||||||
route: '/'
|
route: '/'
|
||||||
connectOutlets: (router) ->
|
connectOutlets: (router) ->
|
||||||
router.get('repositoryController').activate('index')
|
router.get('repositoryController').activate('index')
|
||||||
|
|
||||||
stats: Ember.Route.extend
|
|
||||||
route: '/stats'
|
|
||||||
connectOutlets: (router) ->
|
|
||||||
router.get('applicationController').connectOutlet 'main', 'stats'
|
|
||||||
|
|
||||||
repository: Ember.Route.extend
|
repository: Ember.Route.extend
|
||||||
initialState: 'show'
|
initialState: 'show'
|
||||||
route: '/:owner/:name'
|
route: '/:owner/:name'
|
||||||
|
|
|
@ -1 +1,6 @@
|
||||||
heyho
|
{{! TODO apparently styles assume that there is more divs here...
|
||||||
|
I should fix that later }}
|
||||||
|
<div>
|
||||||
|
{{outlet}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
{{! TODO apparently styles assume that there is more divs here...
|
|
||||||
I should fix that later }}
|
|
||||||
<div><div>
|
|
||||||
<div id="top">
|
<div id="top">
|
||||||
{{outlet top}}
|
{{outlet top}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,4 +15,3 @@
|
||||||
{{outlet right}}
|
{{outlet right}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
<li {{bindAttr class="view.classProfile"}}>
|
<li {{bindAttr class="view.classProfile"}}>
|
||||||
<p class="handle">
|
<p class="handle">
|
||||||
<a class="signed-out" href="#" {{action signIn target="Travis.app"}}>{{t layouts.top.github_login}}</a>
|
<a class="signed-out" href="#" {{action signIn target="Travis.app"}}>{{t layouts.top.github_login}}</a>
|
||||||
<a class="signed-in" href="/profile" {{action route}}><img {{bindAttr src="view.gravatarUrl"}}>{{user.name}}</a>
|
<a class="signed-in" {{action showProfile href=true}}><img {{bindAttr src="view.gravatarUrl"}}>{{user.name}}</a>
|
||||||
<span class="signing-in">Signing in</span>
|
<span class="signing-in">Signing in</span>
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="/profile" {{action route}}>{{t layouts.top.profile}}</a>
|
<a {{action showProfile href=true}}>{{t layouts.top.profile}}</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/" {{action signOut target="Travis.app"}}>{{t layouts.top.sign_out}}</a>
|
<a href="/" {{action signOut target="Travis.app"}}>{{t layouts.top.sign_out}}</a>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
{{#collection Travis.AccountsListView contentBinding="controller"}}
|
{{#collection Travis.AccountsListView contentBinding="controller"}}
|
||||||
<a {{bindAttr href="view.urlAccount"}} {{action route}} class="name">{{view.name}}</a>
|
<a {{action showAccount view.account href=true}} class="name">{{view.name}}</a>
|
||||||
<p class="summary">
|
<p class="summary">
|
||||||
<span class="repos_label">Repositories:</span>
|
<span class="repos_label">Repositories:</span>
|
||||||
<abbr class="repos">{{view.content.reposCount}}</abbr>
|
<abbr class="repos">{{view.content.reposCount}}</abbr>
|
||||||
|
|
|
@ -6,4 +6,3 @@
|
||||||
{{outlet pane}}
|
{{outlet pane}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<ul class="tabs">
|
<ul class="tabs">
|
||||||
<li id="tab_hooks" {{bindAttr class="view.classHooks"}}>
|
<li id="tab_hooks" {{bindAttr class="view.classHooks"}}>
|
||||||
<h5>
|
<h5>
|
||||||
<a {{bindAttr href="view.urlAccount"}} {{action route}}>Repositories</a>
|
<a {{action showAccount view.account href=true}}>Repositories</a>
|
||||||
</h5>
|
</h5>
|
||||||
</li>
|
</li>
|
||||||
{{#if view.displayUser}}
|
{{#if view.displayUser}}
|
||||||
<li id="tab_user" {{bindAttr class="view.classUser"}}>
|
<li id="tab_user" {{bindAttr class="view.classUser"}}>
|
||||||
<h5>
|
<h5>
|
||||||
<a {{bindAttr href="view.urlUser"}} {{action route}}>Profile</a>
|
<a {{action showUserProfile view.account href=true}}>Profile</a>
|
||||||
</h5>
|
</h5>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -6,10 +6,10 @@ require 'ext/ember/namespace'
|
||||||
$("##{event.target.name}").remove().appendTo('body').toggle()
|
$("##{event.target.name}").remove().appendTo('body').toggle()
|
||||||
|
|
||||||
@Travis.reopen
|
@Travis.reopen
|
||||||
HomeLayout: Travis.View.extend(templateName: 'layouts/home')
|
HomeView: Travis.View.extend(templateName: 'layouts/home')
|
||||||
ProfileLayout: Travis.View.extend(templateName: 'layouts/profile')
|
ProfileLayoutView: Travis.View.extend(templateName: 'layouts/profile')
|
||||||
StatsLayout: Travis.View.extend(templateName: 'layouts/simple')
|
StatsLayoutView: Travis.View.extend(templateName: 'layouts/simple')
|
||||||
ApplicationView: Travis.View.extend(templateName: 'layouts/home')
|
ApplicationView: Travis.View.extend(templateName: 'application')
|
||||||
|
|
||||||
require 'views/build'
|
require 'views/build'
|
||||||
require 'views/job'
|
require 'views/job'
|
||||||
|
|
|
@ -53,13 +53,7 @@
|
||||||
'active' if @get('tab') == 'user'
|
'active' if @get('tab') == 'user'
|
||||||
).property('tab')
|
).property('tab')
|
||||||
|
|
||||||
urlAccount: (->
|
accountBinding: 'controller.account'
|
||||||
Travis.Urls.account(@get('controller.account.login'))
|
|
||||||
).property('controller.account.login')
|
|
||||||
|
|
||||||
urlUser: (->
|
|
||||||
Travis.Urls.user(@get('controller.user.login'))
|
|
||||||
).property('controller.user.login')
|
|
||||||
|
|
||||||
displayUser: (->
|
displayUser: (->
|
||||||
@get('controller.account.login') == @get('controller.user.login')
|
@get('controller.account.login') == @get('controller.user.login')
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user