diff options
author | michal <michal.sipa@mirumee.com> | 2017-10-06 14:22:50 +0200 |
---|---|---|
committer | michal <michal.sipa@mirumee.com> | 2017-10-06 14:22:50 +0200 |
commit | 0ba195f2efdacb674c8ff7affbea353abbe2a936 (patch) | |
tree | 28ea4f3afb583e5f44a202a779aa655b8f1d19ce /saleor/product | |
parent | 0d11f7d0285b2dca7c7539049d01eafd8da6b99e (diff) | |
download | saleor-frontend-0ba195f2efdacb674c8ff7affbea353abbe2a936.tar.gz saleor-frontend-0ba195f2efdacb674c8ff7affbea353abbe2a936.tar.bz2 saleor-frontend-0ba195f2efdacb674c8ff7affbea353abbe2a936.zip |
Further refactoring of sort_by and sort_menu
Combine sort_by and sort_menu to one template and templatetag.
Move templatetags to shop.py.
Delete sort_menu.py and _sort_menu.html.
Update index.html with new templatetags.
Diffstat (limited to 'saleor/product')
-rw-r--r-- | saleor/product/templatetags/sort_by.py | 11 | ||||
-rw-r--r-- | saleor/product/templatetags/sort_menu.py | 17 |
2 files changed, 0 insertions, 28 deletions
diff --git a/saleor/product/templatetags/sort_by.py b/saleor/product/templatetags/sort_by.py deleted file mode 100644 index 58395c07..00000000 --- a/saleor/product/templatetags/sort_by.py +++ /dev/null @@ -1,11 +0,0 @@ -from django import template - -register = template.Library() - - -@register.inclusion_tag('category/_sort_by.html', takes_context=True) -def sort_by(context, attribute): - return {'request': context['request'], - 'label': attribute['label'], - 'ascending_attribute': attribute['value'], - 'descending_attribute': '-' + str(attribute['value'])} diff --git a/saleor/product/templatetags/sort_menu.py b/saleor/product/templatetags/sort_menu.py deleted file mode 100644 index d538f055..00000000 --- a/saleor/product/templatetags/sort_menu.py +++ /dev/null @@ -1,17 +0,0 @@ -from django import template - -from ..filters import DEFAULT_SORT - -register = template.Library() - - -@register.inclusion_tag('category/_sort_menu.html', takes_context=True) -def sort_menu(context, attributes): - ctx = { - 'request': context['request'], - 'sort_by': (context['request'].GET.get('sort_by', DEFAULT_SORT) - .strip('-')), - 'sort_by_choices': attributes, - 'arrow_down': (context['request'].GET.get('sort_by', DEFAULT_SORT) - .startswith('-'))} - return ctx |