Advertisement
rubenbristian

sidebar_nav-collections.liquid (for three menu level)

Apr 30th, 2015
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.84 KB | None | 0 0
  1. {% assign current_menu = {{sidebar_nav-collections}} %}
  2. {% capture menu_size %} {{ linklists[current_menu].links | size }} {% endcapture %}
  3. <ul class="top-menu collections-menu size-{{ menu_size | lstrip | rstrip }}">
  4.  
  5.     {% for link in linklists[current_menu].links %}
  6.  
  7.         {% assign child_list_handle = link.title | handleize %}
  8.  
  9.         {% if linklists[child_list_handle].links != blank %}
  10.  
  11.             {% assign submenu_active = false %}
  12.             {% for childlink in linklists[child_list_handle].links %}
  13.                 {% if childlink.active %}
  14.                     {% assign submenu_active = true %}
  15.                 {% endif %}
  16.             {% endfor %}
  17.  
  18.             <li class="submenu{% if link.active or submenu_active %} selected{% endif %}" aria-haspopup="true">
  19.                 <a href="{{ link.url }}">
  20.                     {{ link.title }}
  21.                     {% include 'asset_svg' with 'arrow_icon' %}
  22.                 </a>
  23.                 <ul class="sub-menu">
  24.                     {% assign grand_child_list_handle = childlink.title | handle %}  
  25.  
  26.                     {% if linklists[grand_child_list_handle] and linklists[grand_child_list_handle].links.size > 0 %}
  27.  
  28.                         <li class="thirdmenu">
  29.                             <a href="{{ link.url }}">
  30.                                 {{ childlink.title }}
  31.                                 {% include 'asset_svg' with 'arrow_icon' %}
  32.                             </a>
  33.  
  34.                             <ul class="third-menu">
  35.                                 {% for grand_childlink in linklists[grand_child_list_handle].links %}
  36.                                     <li>
  37.                                       {{ grand_childlink.title | link_to: grand_childlink.url }}
  38.                                     </li>
  39.                                 {% endfor %}
  40.                             </ul>
  41.                         </li>
  42.  
  43.                     {% else %}
  44.  
  45.                         <li{% if childlink.active %} class="selected"{% endif %}><a href="{{ childlink.url }}">{{ childlink.title | escape }}</a></li>
  46.  
  47.                     {% endif %}
  48.                 {% endfor %}
  49.                 </ul>
  50.             </li>
  51.  
  52.         {% else %}
  53.  
  54.             <li{% if link.active %} class="selected"{% endif %}>
  55.                 <a href="{{ link.url }}">{{ link.title }}</a>
  56.             </li>
  57.            
  58.         {% endif %}
  59.  
  60.     {% endfor %}
  61.  
  62. </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement