Last active
December 14, 2015 04:59
-
-
Save raytiley/5031980 to your computer and use it in GitHub Desktop.
How do I set it up so that task view and timeline view get rendered to the appropriate outlets. Both task and timeline view need the context of the specific task that is being viewed. /#/tasks/:task_id
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/x-handlebars" data-template-name="tasks"> | |
<div class="row"> | |
<div class="span3"> | |
<h3>Task Sets</h2> | |
<ul> | |
{{#each taskSet in controller}} | |
<li>{{#linkTo "taskSet" taskSet}}{{ taskSet.name }}{{/linkTo}}</li> | |
{{/each}} | |
</ul> | |
</div> | |
<div class="span9"> | |
{{outlet}} | |
</div> | |
</div> | |
<div class="row"> | |
<div class="span12"> | |
{{outlet timeline}} | |
</div> | |
</div> | |
</script> | |
<script type="text/x-handlebars" data-template-name="task"> | |
<h3>Task Details</h3> | |
</script> | |
<script type="text/x-handlebars" data-template-name="tasks/index"> | |
Please choose a task. | |
</script> | |
<script type="text/x-handlebars" data-template-name="timeline"> | |
<h3>Task Timeline</h3> | |
</script> | |
App.Router.map(function() { | |
this.resource('tasks', function() { | |
this.resource('task', {path:':task_id'}); | |
}); | |
}); | |
App.TaskSetsRoute = Ember.Route.extend({ | |
model: function() { | |
return App.TaskSet.find(); | |
} | |
}); | |
App.TaskRoute = Ember.Route.extend({ | |
model: function(params) { | |
return App.TaskSet.find(params.taskSet_id); | |
}, | |
renderTemplate: function(controller, model) { | |
this.render('task'); //Will render into the normal unnamed outlet. | |
this.render('timeline', {outlet:'timeline'}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment