Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Get rid of cart dropdown and fix appearance of errors
Adam Bogdał4b2e46584f54
diff --git a/saleor/core/templates/bootstrap/_field_vertical.html b/saleor/core/templates/bootstrap/_field_vertical.htmlindex 2cb05f0640..1164b39dc6 100644--- a/saleor/core/templates/bootstrap/_field_vertical.html+++ b/saleor/core/templates/bootstrap/_field_vertical.html@@ -2,7 +2,7 @@{% if bound_field.is_hidden %}{{ bound_field }}{% else %}-<div class="form-group {{ bound_field.html_name }}{% if bound_field.errors %} has-error{% endif %}{% if input_type == "input" %} has-feedback{% endif %}{% if bound_field.field.required %} required{% endif %}">+<div class="form-group {{ bound_field.html_name }}{% if bound_field.errors %} has-error{% endif %}{% if bound_field.field.required %} required{% endif %}">{% if show_label %}<label class="control-label" for="id_{{ bound_field.html_name }}">{{ bound_field.label }}</label>{% endif %}@@ -41,9 +41,6 @@{% if bound_field.errors %}{% for error in bound_field.errors %}- {% if input_type == "input" %}- <span class="glyphicon glyphicon-remove form-control-feedback"></span>- {% endif %}<span class="text-danger">{{ error }}</span>{% endfor %}{% endif %}diff --git a/saleor/product/views.py b/saleor/product/views.pyindex 308edf51b8..4e5c082b6c 100644--- a/saleor/product/views.py+++ b/saleor/product/views.py@@ -25,12 +25,8 @@ def product_details(request, slug, product_id):form = form_class(cart=cart, product=product,data=request.POST or None)if form.is_valid():- if form.cleaned_data['quantity']:- msg = _('Added %(product)s to your cart.') % {- 'product': product}- messages.success(request, msg)form.save()- return redirect('product:details', slug=slug, product_id=product_id)+ return redirect('cart:index')template_name = 'product/details_%s.html' % (type(product).__name__.lower(),)templates = [template_name, 'product/details.html']diff --git a/templates/base.html b/templates/base.htmlindex 1faeb5744c..2c743756dd 100644--- a/templates/base.html+++ b/templates/base.html@@ -47,27 +47,12 @@{% endfor %}</ul><ul class="nav navbar-nav navbar-right">- <li class="dropdown">- <a data-toggle="dropdown" class="dropdown-toggle" href="{% url "cart:index" %}"><i class="fa fa-shopping-cart"></i> {% trans "Shopping cart" %} {% if request.cart %}<span class="badge">{{ request.cart.count }}</span>{% endif %} <b class="caret"></b></a>- <ul class="dropdown-menu">- <li><a href="{% url "cart:index" %}">{% trans "View cart contents" %}</a></li>- {% if request.cart %}- <li class="divider"></li>- {% for item in request.cart %}- <li>- <a href="{% url 'product:details' slug=item.data.product_slug product_id=item.data.product_id %}">- {{ item.product }}{% if item.quantity != 1 %} <em>×{{ item.quantity }}</em>{% endif %}- </a>- </li>- {% endfor %}- <li class="divider"></li>- <li><a href="{% url "checkout:index" %}">{% trans "Proceed to checkout" %}</a></li>- {% endif %}- </ul>+ <li>+ <a href="{% url "cart:index" %}"><i class="fa fa-shopping-cart"></i> {% trans "Cart" %} {% if request.cart %}<span class="badge">{{ request.cart.count }}</span>{% endif %}</a></li>{% if user.is_authenticated %}<li class="dropdown">- <a data-toggle="dropdown" class="dropdown-toggle" href="."><i class="glyphicon glyphicon-user"></i> {{ user }} <b class="caret"></b></a>+ <a data-toggle="dropdown" class="dropdown-toggle" href=".">{% blocktrans %}Hello, {{ user }}{% endblocktrans %} <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="{% url "profile:details" %}">{% trans "Your profile" %}</a></li><li><a href="{% url "profile:orders" %}">{% trans "Your orders" %}</a></li>@@ -81,7 +66,7 @@</li>{% else %}<li>- <a href="{% url "registration:login" %}">Log in</a>+ <a href="{% url "registration:login" %}">Sign in</a></li>{% endif %}</ul>