Skip to content

Instantly share code, notes, and snippets.

@darryn
Created October 19, 2014 21:35
Show Gist options
  • Save darryn/5b370006971587191ae0 to your computer and use it in GitHub Desktop.
Save darryn/5b370006971587191ae0 to your computer and use it in GitHub Desktop.
Lucid One - Collapsable Sidebar Menu
<!-- SIDEBAR LINKLISTS -->
{% for i in (1..3) %}
{% assign t_sidebar_linklist = 'sidebar_linklist_' | append: i %}
{% assign sidebar_linklist = settings[t_sidebar_linklist] %}
{% if linklists[sidebar_linklist].links.size > 0 %}
<h3 class="l-m">{{ linklists[sidebar_linklist].title }}</h3>
<ul class="nav nav-list">
{% for link in linklists[sidebar_linklist].links %}
{% assign submenu = link.handle %}
{% if linklists[submenu].links.size > 0 %}
<li>
<a href="#" data-toggle="collapse" data-target="#{{ i | append: '-' | append: link.handle }}">{{ link.title }}&nbsp;<span>+</span></a>
{% for l in linklists[submenu].links %}{% if l.active %}{% assign active_sub = true %}{% endif %}{% endfor %}
<ul class="subnav collapse{% if active_sub == true %} in{% endif %}" id="{{ i | append: '-' | append: link.handle }}">
{% for l in linklists[submenu].links %}
<li>{{ l.title | link_to: l.url }}</li>
{% endfor %}
</ul>
{% assign active_sub = false %}
</li>
{% else %}
<li>{{ link.title | link_to: link.url }}</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment