|
App = Ember.Application.create({}); |
|
|
|
App.Router.map(function() { |
|
this.resource('panels', { path: '/:leftTab/:rightTab' }); |
|
}); |
|
|
|
App.ApplicationRoute = Ember.Route.extend({ |
|
events: { |
|
leftTabChanged: function(tab) { |
|
this.controllerFor('application').set('leftTab', tab); |
|
this.transitionTo('panels', { |
|
leftTab: tab, |
|
rightTab: this.controllerFor('application').get('rightTab') |
|
}); |
|
|
|
}, |
|
rightTabChanged: function(tab) { |
|
this.controllerFor('application').set('rightTab', tab); |
|
this.transitionTo('panels', { |
|
leftTab:this.controllerFor('application').get('leftTab'), |
|
rightTab:tab |
|
}); |
|
} |
|
}, |
|
|
|
renderTemplate: function() { |
|
this.render(); |
|
this.render('leftPanel', { |
|
outlet: 'leftPanel', |
|
into: 'application' |
|
}); |
|
|
|
this.render('rightPanel', { |
|
outlet: 'rightPanel', |
|
into: 'application' |
|
}); |
|
} |
|
}); |
|
|
|
App.IndexRoute = Ember.Route.extend({ |
|
redirect: function() { |
|
this.transitionTo('panels', { |
|
leftTab: this.controllerFor('application').get('leftTab'), |
|
rightTab: this.controllerFor('application').get('rightTab') |
|
}); |
|
} |
|
}); |
|
|
|
App.PanelsRoute = Ember.Route.extend({ |
|
serialize: function(params, paramNames) { |
|
return params; |
|
}, |
|
renderTemplate: function(controller, params) { |
|
|
|
this.render(params.leftTab, { |
|
into: 'leftPanel' |
|
}); |
|
|
|
|
|
this.render(params.rightTab, { |
|
into: 'rightPanel' |
|
}); |
|
} |
|
}); |
|
|
|
App.ApplicationController = Ember.Controller.extend({ |
|
leftTab: 'leftPanelTab1', |
|
rightTab: 'rightPanelTab1' |
|
}); |
|
|
|
App.LeftPanelController = Ember.Controller.extend({ |
|
selectTab: function(tab) { |
|
this.send('leftTabChanged', tab); |
|
} |
|
}); |
|
|
|
App.LeftPanelView = Ember.View.extend({ |
|
classNames: ['pane'] |
|
}); |
|
|
|
App.RightPanelController = Ember.Controller.extend({ |
|
selectTab: function(tab) { |
|
this.send('rightTabChanged', tab); |
|
} |
|
}); |
|
|
|
App.RightPanelView = Ember.View.extend({ |
|
classNames: ['pane'] |
|
}); |