Created
December 5, 2014 01:01
-
-
Save filipmares/835cb18de27c0572a2a3 to your computer and use it in GitHub Desktop.
LayoutView
This file contains 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
/* | |
A simple task list app with standard sidebar and main area design | |
_______________________ | |
| | | | |
|sidebar| main | | |
|_______|_______________| | |
*/ | |
// Define a LayoutView and its Regions | |
var AppLayoutView = Backbone.Marionette.LayoutView.extend({ | |
template: "#my-app-layout", | |
regions: { | |
taskList: "#side-bar", | |
taskDetail: "#main-content" | |
} | |
}); | |
// Create a LayoutView | |
var layoutView = new AppLayoutView(); | |
layoutView.render(); | |
// Show a list of tasks | |
layoutView.taskList.show(new TasksCollectionView()); | |
// Show task detail view | |
layoutView.taskDetail.show(new TaskDetailView()); | |
// Empties Region in the DOM and also destroys view while unbinding all listeners | |
layoutView.content.empty() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment