This is my html and view. I managed to display the left and right menu item by appending the layout to a 'headerRegion' defined in my app.js. I extended the Region.js to accept a boolean to know if I should append or clear the view. So, that way I append the left and right views ( LeftHeaders and RightHeaders ) in the code below. But, I'm not sure how I can get the drop-down displayed. Is this approach correct?
SampleManager.module("HeaderApp.List", function(List, SampleApp, Backbone, Marionette, $, _){
List.HeaderLayout = Backbone.Marionette.Layout.extend({
template:"#header-layout",
regions:{
headerMenuRegions:{
selector:"#headerMenuRegions"
,appendViews:true
}
},
tagName:"div",
className:"container-fluid"
});
List.Header = Backbone.Marionette.CompositeView.extend({
template: "#header-item",
tagName:"li"
});
List.LeftHeaders = Backbone.Marionette.CollectionView.extend({
itemView:List.Header,
tagName:"ul",
className:"nav navbar-nav"
});
List.RightHeaders = Backbone.Marionette.CollectionView.extend({
itemView:List.Header,
tagName:"ul",
className:"nav navbar-nav navbar-right"
});
});
<div class="container">
<!-- Static navbar -->
<div id="header-region" class="navbar navbar-default" role="navigation">
</div>
<!-- Main component for a primary marketing message or call to action -->
<div class="jumbotron">
<h1>Navbar example</h1>
<p>This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
<p>
<a class="btn btn-lg btn-primary" href="../../components/#navbar" role="button">View navbar docs »</a>
</p>
</div>
</div> <!-- /container -->
<script type="text/template" id="header-layout">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="navbar-collapse collapse" id="headerMenuRegions">
</div><!--/.nav-collapse -->
</script>
<script type="text/template" id="header-item">
<a href="#"><%=headerMenu%></a>
</script>
Thanks.