forked from Shopify/Timber
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Shopify#69 from Shopify/collection-sidebar
Type, Vendor, and Tag lists for collections
- Loading branch information
Showing
5 changed files
with
161 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
{% comment %} | ||
Side navigation for the product types, vendors, and tags. | ||
These can be based on the current collection or all products. Details in comments below. | ||
Note: Clicking on a tag will filter the products within the current collection. | ||
Clicking on a type or vendor link will take you out of the current collection | ||
to a standalone collection page. E.g. /collections/vendors?q=Pepsi | ||
{% endcomment %} | ||
|
||
{% comment %} | ||
Show the description for the current collection | ||
{% endcomment %} | ||
{% if collection.description.size > 0 %} | ||
<div class="rte"> | ||
{{ collection.description }} | ||
</div> | ||
{% endif %} | ||
|
||
{% comment %} | ||
Product types in the current collection | ||
- List all of the shop's types with collections.all.all_types | ||
- List the current collection's types with collection.all_types | ||
{% endcomment %} | ||
<h3>Product Types</h3> | ||
{% if collection.all_types.size > 0 %} | ||
|
||
<ul> | ||
{% comment %} | ||
And for the good stuff, loop through the tags themselves. | ||
{% endcomment %} | ||
{% for type in collection.all_types %} | ||
{% if collection.current_type == type %} | ||
<li class="active-filter"> | ||
{{ type | link_to_remove_type }} | ||
</li> | ||
{% else %} | ||
<li> | ||
{{ type | link_to_type }} | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
</ul> | ||
|
||
{% else %} | ||
|
||
<p>Add a type to your products for this list to build itself. All lists are created in <strong>collection-tags.liquid</strong>.</p> | ||
|
||
{% endif %} | ||
|
||
{% comment %} | ||
Product vendors in the current collection | ||
- List all of the shop's vendors with collections.all.all_vendors | ||
- List the current collection's vendors with collection.all_vendors | ||
{% endcomment %} | ||
<h3>Vendors</h3> | ||
{% if collection.all_vendors.size > 0 %} | ||
|
||
<ul> | ||
{% comment %} | ||
And for the good stuff, loop through the tags themselves. | ||
{% endcomment %} | ||
{% for vendor in collection.all_vendors %} | ||
{% if collection.current_vendor == vendor %} | ||
<li class="active-filter"> | ||
{{ vendor | link_to_remove_vendor }} | ||
</li> | ||
{% else %} | ||
<li> | ||
{{ vendor | link_to_vendor }} | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
</ul> | ||
|
||
{% else %} | ||
|
||
<p>Add a vendor to your product for this list to build itself.</p> | ||
|
||
{% endif %} | ||
|
||
{% comment %} | ||
Product tags in the current collection | ||
{% endcomment %} | ||
<h3>Tags</h3> | ||
{% if collection.all_tags.size > 0 %} | ||
|
||
{% comment %} | ||
Say we want to provide a 'catch-all' link at the top of the list, | ||
we'd check against the collection.handle, product type, and vendor. | ||
{% endcomment %} | ||
|
||
<ul> | ||
<li{% unless current_tags %} class="active-filter"{% endunless %}> | ||
|
||
{% comment %} | ||
Good for /collections/all collection and regular collections | ||
{% endcomment %} | ||
{% if collection.handle %} | ||
<a href="/collections/{{ collection.handle }}">Everything in {{ collection.title }}</a> | ||
|
||
{% comment %} | ||
Good for automatic type collections | ||
{% endcomment %} | ||
{% elsif collection.current_type %} | ||
<a href="{{ collection.current_type | url_for_type }}">Everything in {{ collection.title }}</a> | ||
|
||
{% comment %} | ||
Good for automatic vendor collections | ||
{% endcomment %} | ||
{% elsif collection.current_vendor %} | ||
<a href="{{ collection.current_vendor | url_for_vendor }}">Everything in {{ collection.title }}</a> | ||
|
||
{% endif %} | ||
</li> | ||
|
||
{% comment %} | ||
And for the good stuff, loop through the tags themselves. | ||
{% endcomment %} | ||
{% for tag in collection.all_tags %} | ||
{% if current_tags contains tag %} | ||
<li class="active-filter"> | ||
{{ tag | link_to_remove_tag: tag }} | ||
</li> | ||
{% else %} | ||
<li> | ||
{% comment %} | ||
Use link_to_add_tag if you want to allow filtering | ||
by multiple tags | ||
{% endcomment %} | ||
{{ tag | link_to_tag: tag }} | ||
</li> | ||
{% endif %} | ||
{% endfor %} | ||
|
||
</ul> | ||
|
||
{% else %} | ||
|
||
<p>Add tags to your products for this list to build itself.</p> | ||
|
||
{% endif %} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters