Created
June 10, 2015 14:58
-
-
Save belackriv/f1c53485985f76d8002b to your computer and use it in GitHub Desktop.
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
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