Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Created March 6, 2015 17:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevewithington/0067ac68562a17612ea8 to your computer and use it in GitHub Desktop.
Save stevewithington/0067ac68562a17612ea8 to your computer and use it in GitHub Desktop.
Mura CMS: How to create Bootstrap tabs of children content as either links, or with panels.
<!--- Mura CMS Bootstrap Tabs With Panels --->
<cfoutput>
<cfset it = $.content().getKidsIterator() />
<!--- Only output if there's any kids --->
<cfif it.hasNext()>
<div role="tabpanel">
<!--- Nav Tabs --->
<ul class="nav nav-tabs" role="tablist">
<cfloop condition="it.hasNext()">
<cfset item = it.next() />
<cfset tabClass = it.currentIndex() == 1 ? 'active' : '' />
<li role="presentation" class="#tabClass#">
<a href="##tab#it.currentIndex()#" role="tab" data-toggle="tab">
#esapiEncode('html', item.getValue('menuTitle'))#
</a>
</li>
</cfloop>
</ul>
<!--- We need to reset the iterator, so we can loop over it again! --->
<cfset it.reset() />
<!--- Tab Panes --->
<div class="tab-content">
<cfloop condition="it.hasNext()">
<cfset item = it.next() />
<cfset tabClass = it.currentIndex() == 1 ? 'in active' : '' />
<div id="tab#it.currentIndex()#" role="tabpanel" class="tab-pane fade #tabClass#">
<!--- This is the tab pane area where you can output anything you want --->
<h3>#esapiEncode('html', item.getValue('title'))#</h3>
<ul>
<li>Created: #item.getValue('created')#</li>
<li>Last Update: #item.getValue('lastupdate')#</li>
<li>Last Update By: #item.getValue('lastupdateby')#</li>
</ul>
</div>
</cfloop>
</div>
</div>
<!--- /tabpanel --->
</cfif>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment