Skip to content

Instantly share code, notes, and snippets.

@belackriv
Created June 10, 2015 14:58
Show Gist options
  • Save belackriv/f1c53485985f76d8002b to your computer and use it in GitHub Desktop.
Save belackriv/f1c53485985f76d8002b to your computer and use it in GitHub Desktop.
var TabsLayoutView = Backbone.Marionette.LayoutView.extend({
initialize: function(options){
this.tabOneViewInstance = new TabOneiew();
this.tabTwoViewInstance = new TabTwoView();
this.tabThreeViewInstance = new TabThreeView();
},
template: "#tabs_layout_template",
regions: {
content: ".content-pane"
},
ui: {
showViewLink: '.show-view-link'
},
events: {
"click @ui.showViewLink": "showViewLinkClicked",
},
showViewLinkClicked: function(event){
event.preventDefault();
var viewName = event.target.dataset.viewName;
if(viewName.ucfirst() !== typeof this.getRegion('content').currentView){
this.getRegion('content').show(this[viewName+'Instance'], {preventDestroy: true});
}
},
onBeforeShow: function(){
this.showChildView('content', this.tabOneViewInstance);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment