Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove language picker and menu templates and unused templatetags

IKarbowiak7dec721d732d
diff --git a/saleor/core/templatetags/shop.py b/saleor/core/templatetags/shop.py
deleted file mode 100644
index 1d4d427a11..0000000000
--- a/saleor/core/templatetags/shop.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from django.template import Library
-from django.utils.http import urlencode
-
-register = Library()
-
-
[email protected]_tag(takes_context=True)
-def get_sort_by_url(context, field, descending=False):
- request = context["request"]
- request_get = request.GET.dict()
- if descending:
- request_get["sort_by"] = "-" + field
- else:
- request_get["sort_by"] = field
- return "%s?%s" % (request.path, urlencode(request_get))
-
-
[email protected]_tag("menu.html")
-def menu(site_menu=None, horizontal=False):
- menu_items = site_menu.json_content if site_menu else []
- return {"menu_items": menu_items, "horizontal": horizontal}
-
-
[email protected]_tag("footer_menu.html")
-def footer_menu(site_menu=None):
- menu_items = site_menu.json_content if site_menu else []
- return {"menu_items": menu_items}
-
-
-def get_menu_item_name(menu_item, lang_code):
- translated = menu_item["translations"].get(lang_code)
- if translated:
- return translated["name"]
- return menu_item["name"]
diff --git a/templates/_language_picker.html b/templates/_language_picker.html
deleted file mode 100644
index 317e2192d6..0000000000
--- a/templates/_language_picker.html
+++ /dev/null
@@ -1,17 +0,0 @@
-{% load i18n %}
-{% get_current_language as LANGUAGE_CODE %}
-{% get_language_info_list for LANGUAGES as languages %}
-
-{% if languages|length > 1 %}
-<div class="dropdown-menu scrollable-menu">
- <form id="language-picker" action="{% url 'set_language' %}" method="post">
- {% csrf_token %}
- <input name="next" type="hidden" value="{{ request.get_full_path }}">
- {% for language in languages %}
- <a data-lang="{{ language.code }}" class="dropdown-item language-pick dropdown-link{% if language.code == LANGUAGE_CODE %} active{% endif %}">
- {{ language.name_local }}
- </a>
- {% endfor %}
- </form>
-</div>
-{% endif %}
diff --git a/templates/_language_picker_modal.html b/templates/_language_picker_modal.html
deleted file mode 100644
index 923629daf5..0000000000
--- a/templates/_language_picker_modal.html
+++ /dev/null
@@ -1,30 +0,0 @@
-{% load i18n %}
-
-{% get_language_info_list for LANGUAGES as languages %}
-<div id="languagePickerModal" class="modal fade" role="dialog">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title">{% trans "Select language" context "Change language modal title" %}</h5>
- </div>
- <form id="language-picker" action="{% url 'set_language' %}" method="POST">
- <div class="modal-body">
- {% csrf_token %}
- <input name="next" type="hidden" value="{{ request.get_full_path }}">
- {% for language in languages %}
- <div class="radio">
- <label>
- <input type="radio" name="language" value="{{ language.code}}" {% if language.code == LANGUAGE_CODE %}checked{% endif %}>
- {{ language.name_local }}
- </label>
- </div>
- {% endfor %}
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" context "Close modal action button" %}</button>
- <button type="submit" id="language-picker-btn" class="btn btn-primary narrow">{% trans "Change" context "Change language action button" %}</button>
- </div>
- </form>
- </div>
- </div>
-</div>
diff --git a/templates/checkout_dropdown.html b/templates/checkout_dropdown.html
deleted file mode 100644
index 0383145054..0000000000
--- a/templates/checkout_dropdown.html
+++ /dev/null
@@ -1,70 +0,0 @@
-{% load i18n %}
-{% load get_thumbnail from product_images %}
-{% load placeholder %}
-{% load price from taxed_prices %}
-{% load static %}
-
-<div class="container">
- {% if quantity > 0 %}
- <div id="checkout-preview-dropdown-list" class="checkout-preview-dropdown__list{% if lines|length <= 2 %} overflow{% endif %}">
- {% for line in lines %}
- <div class="row item">
- <div class="col-md-10">
- <a class="link--clean" href="{{ line.variant_url }}">
- <img class="checkout-preview-dropdown__image lazyload lazypreload"
- data-src="{% get_thumbnail line.image size=60 method="thumbnail" %}"
- data-srcset="{% get_thumbnail line.image size=60 method="thumbnail" %} 1x, {% get_thumbnail line.image size=120 method="thumbnail" %} 2x"
- alt=""
- src="{% placeholder size=120 %}">
- <h3>
- {{ line.product.translated }}
- <span>x{{ line.quantity }}</span>
- <p>{{ line.variant.translated }}</p>
- </h3>
- </a>
- </div>
- <div class="col-md-2">
- <div class="float-right">
- <h3>
- {% price line.line_total %}
- </h3>
- </div>
- </div>
- </div>
- {% endfor %}
- </div>
- <div class="row checkout-preview-dropdown__total" data-quantity="{{ quantity }}">
- <div class="col-md-8">
- <h3>
- {% trans "Subtotal" context "Order subtotal" %}<br>
- <span>{% trans "Shipment and taxes calculated at checkout" context "Checkout dropdown text" %}</span>
- </h3>
- </div>
- <div class="col-md-4">
- <h3 class="float-md-right price {% if lines|length <= 2 %}single{% endif %}" data-quantity="{{ quantity }}">
- <p>
- {% price total %}
- </p>
- </h3>
- </div>
- </div>
- <div class="row checkout-preview-dropdown__actions">
- <div class="col-md-1"></div>
- <div class="col-md-5">
- <a href="{% url "checkout:index" %}" class="btn secondary narrow float-md-right">{% trans "Go to cart" context "Checkout dropdown secondary action" %}</a>
- </div>
- <div class="col-md-5">
- <a href="{% url "checkout:login" %}" class="btn btn-primary narrow float-md-right">{% trans "Checkout" context "Checkout dropdown primary action" %}</a>
- </div>
- </div>
- {% else %}
- <div class="text-md-center checkout-preview-dropdown__empty">
- <h3>{% trans "There are no products in your shopping cart." context "Empty checkout message" %}</h3>
- <img data-src="{% static 'images/empty-checkout-bg.png' %}"
- data-srcset="{% static 'images/empty-checkout-bg.png' %} 1x, {% static 'images/empty-checkout-bg2x.png' %} 2x"
- src="{% placeholder size=255 %}"
- class="lazyload lazypreload">
- <a href="{% url 'home' %}" class="btn btn-primary">{% trans "Check out our sales" context "Empty checkout link" %}</a>
- </div>
- {% endif %}
-</div>
diff --git a/templates/footer_menu.html b/templates/footer_menu.html
deleted file mode 100644
index 492d76041e..0000000000
--- a/templates/footer_menu.html
+++ /dev/null
@@ -1,46 +0,0 @@
-{% url 'home' as home_url %}
-{% load i18n %}
-{% get_current_language as LANGUAGE_CODE %}
-{% load get_menu_item_name from shop %}
-
-{% for item in menu_items %}
-{% with children=item.child_items %}
- <div class="col-6 col-md-2">
- <ul class="menu">
- <li class="{% if children %}nav-item__dropdown{% endif %} menu__item">
- <a href="{{ item.url }}">
- {% get_menu_item_name lang_code=LANGUAGE_CODE menu_item=item %}
- </a>
- {% if children %}
- <hr />
- <div class="nav-item__submenu">
- <ul>
- {% for child in children %}
- <li>
- <a href="{{ child.url }}">
- {% get_menu_item_name lang_code=LANGUAGE_CODE menu_item=child %}
- </a>
-
- {% with grandchildren=child.child_items %}
- {% if grandchildren %}
- <ul>
- {% for grandchild in grandchildren %}
- <li>
- <a href="{{ grandchild.url }}">
- {% get_menu_item_name lang_code=LANGUAGE_CODE menu_item=grandchild %}
- </a>
- </li>
- {% endfor %}
- </ul>
- {% endif %}
- {% endwith %}
- </li>
- {% endfor %}
- </ul>
- </div>
- {% endif %}
- </li>
- </ul>
- </div>
-{% endwith %}
-{% endfor %}
diff --git a/templates/menu.html b/templates/menu.html
deleted file mode 100644
index f05924242e..0000000000
--- a/templates/menu.html
+++ /dev/null
@@ -1,49 +0,0 @@
-{% url 'home' as home_url %}
-{% load i18n %}
-{% get_current_language as LANGUAGE_CODE %}
-{% load get_menu_item_name from shop %}
-
-<ul class="menu {% if horizontal %}nav mb-4 mb-md-0{% endif %}{% if request.get_full_path == home_url %} no-border{% endif %}">
- {% for item in menu_items %}
- {% with children=item.child_items %}
- <li class="{% if horizontal %}nav-item{% endif %} {% if children %}nav-item__dropdown{% endif %} menu__item">
- <a class="{% if horizontal %}nav-link{% endif %}" href="{{ item.url }}">
- {% get_menu_item_name lang_code=LANGUAGE_CODE menu_item=item %}
- </a>
- {% if children %}
- <div class="{% if horizontal %}nav-item__dropdown-content{% else %}nav-item__submenu{% endif %}">
- <div class="container">
- <ul>
- {% for child in children %}
- <li>
- <a href="{{ child.url }}">
- {% if horizontal %}
- <strong>{% get_menu_item_name lang_code=LANGUAGE_CODE menu_item=child %}</strong>
- {% else %}
- {% get_menu_item_name lang_code=LANGUAGE_CODE menu_item=child %}
- {% endif %}
- </a>
-
- {% with grandchildren=child.child_items %}
- {% if grandchildren %}
- <ul>
- {% for grandchild in grandchildren %}
- <li>
- <a href="{{ grandchild.url }}">
- {% get_menu_item_name lang_code=LANGUAGE_CODE menu_item=grandchild %}
- </a>
- </li>
- {% endfor %}
- </ul>
- {% endif %}
- {% endwith %}
- </li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endif %}
- </li>
- {% endwith %}
- {% endfor %}
-</ul>