Skip to content

Instantly share code, notes, and snippets.

@villanuv
Created May 15, 2015 19:37
Show Gist options
  • Save villanuv/e2dd39cdd46eebc76796 to your computer and use it in GitHub Desktop.
Save villanuv/e2dd39cdd46eebc76796 to your computer and use it in GitHub Desktop.
For QDL Tumblr Post #2 Pt. 2
<!-- snippet: automagic-filter-dropdown.liquid -->
{% assign c = 0 %}
{% for t in collection.all_tags %}
{% capture cat %}{{ cat }}{% capture temp_cat %}{% if t contains ':' %}{% assign cat_grp = t | split: ':' %}{{ cat_grp.first }}{% endif %}{% endcapture %}{% unless cat contains temp_cat %}{% if t contains ':' %}{% assign new_cat_grp = t | split: ':' %}{{ new_cat_grp.first }}{% endif %}{% unless forloop.last %}+{% endunless %}{% assign c = c | plus: 1 %}{% endunless %}{% endcapture %}
{% endfor %}
{% assign cat_array = cat | split: '+' %}
{% for i in cat_array %}
{% unless i == '' %}
<li id="select-{{ i | handleize }}">
<a>{{ i | capitalize | replace: 'source', 'Source' | append: ' <span>▼</span>' }}</a>
<ul>
{% for t in collection.all_tags %}
{% if t contains i %}
{% capture menuLink %}{{ t | remove: i | remove: ':' }}{% endcapture %}
{% assign optionVal = t | handleize %}
{% if i == 'width' or i == 'height' %}
{% if menuLink == '08' %}
{% assign option = menuLink | remove: '0' | append: '" and less' | link_to_add_tag: t %}
<li class="{{ optionVal }}">{{ option }}</li>
{% elsif menuLink == '08-12' %}
{% assign option = menuLink | remove: '0' | append: '"' | link_to_add_tag: t %}
<li class="{{ optionVal }}">{{ option }}</li>
{% elsif menuLink == '36' %}
{% assign option = menuLink | append: '" and up' | link_to_add_tag: t %}
<li class="{{ optionVal }}">{{ option }}</li>
{% else %}
{% assign option = menuLink | append: '"' | link_to_add_tag: t %}
<li class="{{ optionVal }}">{{ option }}</li>
{% endif %}
{% elsif i == 'price' %}
{% if menuLink == '25' %}
{% assign option = menuLink | prepend: 'Under $' | link_to_add_tag: t %}
<li class="{{ optionVal }}">{{ option }}</li>
{% elsif menuLink == '200' %}
{% assign option = menuLink | prepend: 'Over $' | link_to_add_tag: t %}
<li class="{{ optionVal }}">{{ option }}</li>
{% else %}
{% assign option = menuLink | prepend: '$' | link_to_add_tag: t %}
<li class="{{ optionVal }}">{{ option }}</li>
{% endif %}
{% else %}
{% assign option = menuLink | link_to_add_tag: t %}
<li class="{{ optionVal }}">{{ option }}</li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</li>
{% endunless %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment