Skip to content

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

Fix breadcrumbs

michalde0e57eabaf2
diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.py
index a3520b298a..0a6ac627a4 100644
--- a/saleor/dashboard/product/views.py
+++ b/saleor/dashboard/product/views.py
@@ -527,6 +527,7 @@ def attribute_delete(request, pk):
@staff_member_required
@permission_required('product.edit_properties')
def attribute_choice_value_edit(request, attribute_pk, value_pk=None):
+ attribute = get_object_or_404(ProductAttribute, pk=attribute_pk)
if value_pk:
value = get_object_or_404(AttributeChoiceValue, pk=value_pk)
else:
@@ -541,10 +542,10 @@ def attribute_choice_value_edit(request, attribute_pk, value_pk=None):
'Dashboard message', 'Added attribute\'s value')
messages.success(request, msg)
return redirect('dashboard:product-attribute-detail', pk=attribute_pk)
- ctx = {'attribute_pk': attribute_pk, 'value': value, 'form': form}
+ ctx = {'attribute': attribute, 'value': value, 'form': form}
return TemplateResponse(
request,
- 'dashboard/product/product_attribute/values_add_edit.html',
+ 'dashboard/product/product_attribute/values/form.html',
ctx)
@@ -562,8 +563,7 @@ def attribute_choice_value_delete(request, attribute_pk, value_pk):
return redirect('dashboard:product-attribute-detail', pk=attribute_pk)
return TemplateResponse(
request,
- 'dashboard/product/product_attribute/modal/'
- 'attribute_choice_value_confirm_delete.html',
+ 'dashboard/product/product_attribute/values/modal/confirm_delete.html',
{'value': value, 'attribute_pk': attribute_pk})
diff --git a/saleor/dashboard/shipping/views.py b/saleor/dashboard/shipping/views.py
index 5b5a62f3d0..61b4b9b904 100644
--- a/saleor/dashboard/shipping/views.py
+++ b/saleor/dashboard/shipping/views.py
@@ -79,23 +79,24 @@ def shipping_method_delete(request, pk):
@staff_member_required
@permission_required('shipping.edit_shipping')
def shipping_method_country_edit(request, shipping_method_pk, country_pk=None):
+ shipping_method = get_object_or_404(ShippingMethod, pk=shipping_method_pk)
if country_pk:
- method = get_object_or_404(ShippingMethodCountry, pk=country_pk)
+ country = get_object_or_404(ShippingMethodCountry, pk=country_pk)
else:
- method = ShippingMethodCountry(shipping_method_id=shipping_method_pk)
- form = ShippingMethodCountryForm(request.POST or None, instance=method)
+ country = ShippingMethodCountry(shipping_method_id=shipping_method_pk)
+ form = ShippingMethodCountryForm(request.POST or None, instance=country)
if form.is_valid():
- method = form.save()
+ country = form.save()
msg = pgettext_lazy(
'Dashboard message',
- 'Updated country shipping price %s') % (method,) \
+ 'Updated country shipping price %s') % (country,) \
if country_pk else pgettext_lazy(
- 'Dashboard message', 'Added country shipping price %s') % (method,)
+ 'Dashboard message', 'Added country shipping price %s') % (country,)
messages.success(request, msg)
return redirect(
'dashboard:shipping-method-detail', pk=shipping_method_pk)
- ctx = {'form': form, 'shipping_method_pk': shipping_method_pk,
- 'method': method}
+ ctx = {'form': form, 'shipping_method': shipping_method,
+ 'country': country}
return TemplateResponse(
request, 'dashboard/shipping/country/form.html', ctx)
diff --git a/templates/dashboard/product/product_attribute/values_add_edit.html b/templates/dashboard/product/product_attribute/values/form.html
similarity index 94%
rename from templates/dashboard/product/product_attribute/values_add_edit.html
rename to templates/dashboard/product/product_attribute/values/form.html
index 6e31ec9340..948f604427 100644
--- a/templates/dashboard/product/product_attribute/values_add_edit.html
+++ b/templates/dashboard/product/product_attribute/values/form.html
@@ -26,7 +26,7 @@
<ul class="breadcrumbs breadcrumbs--history">
<li>
<a href="{% url 'dashboard:product-attributes' %}" class="breadcrumbs--ellipsed-item">
- {% trans "Attributes" context "Dashboard attributes list" %}
+ {% trans "Attributes" context "Dashboard attributes list" %}
</a>
</li>
<li class="back-mobile">
@@ -40,6 +40,8 @@
{{ attribute }}
</a>
</li>
+ {% endif %}
+ {% if value.pk %}
<li>
<span class="breadcrumbs--ellipsed-item">
{% trans "Edit" context "Attribute detail breadcrumbs" %}
@@ -79,14 +81,14 @@
</div>
<div class="card-action right-align">
{% if value.pk %}
- <a href="{% url 'dashboard:product-attribute-detail' pk=attribute_pk %}" class="btn btn-flat">
+ <a href="{% url 'dashboard:product-attribute-detail' pk=attribute.pk %}" class="btn btn-flat">
{% trans "Cancel" context "Dashboard cancel action" %}
</a>
<button type="submit" class="btn waves-effect waves-light">
{% trans "Save" context "Dashboard update action" %}
</button>
{% else %}
- <a href="{% url 'dashboard:product-attribute-detail' pk=attribute_pk%}" class="btn btn-flat">
+ <a href="{% url 'dashboard:product-attribute-detail' pk=attribute.pk%}" class="btn btn-flat">
{% trans "Cancel" context "Dashboard cancel action" %}
</a>
<button type="submit" class="btn waves-effect waves-light">
diff --git a/templates/dashboard/product/product_attribute/modal/attribute_choice_value_confirm_delete.html b/templates/dashboard/product/product_attribute/values/modal/confirm_delete.html
similarity index 100%
rename from templates/dashboard/product/product_attribute/modal/attribute_choice_value_confirm_delete.html
rename to templates/dashboard/product/product_attribute/values/modal/confirm_delete.html
diff --git a/templates/dashboard/shipping/country/form.html b/templates/dashboard/shipping/country/form.html
index 0d964474d5..26b2a83907 100644
--- a/templates/dashboard/shipping/country/form.html
+++ b/templates/dashboard/shipping/country/form.html
@@ -34,12 +34,14 @@
<svg data-src="{% static "dashboard/images/arrow_left.svg" %}" fill="#fff" width="20px" height="20px" />
</a>
</li>
- {% if method.pk %}
+ {% if shipping_method.pk %}
<li>
- <a href="{% url 'dashboard:shipping-method-detail' method.pk %}" class="breadcrumbs--ellipsed-item">
- {{ method }}
+ <a href="{% url 'dashboard:shipping-method-detail' shipping_method.pk %}" class="breadcrumbs--ellipsed-item">
+ {{ shipping_method }}
</a>
</li>
+ {% endif %}
+ {% if country.pk %}
<li>
<span class="breadcrumbs--ellipsed-item">
{% trans "Edit" context "Attribute detail breadcrumbs" %}
@@ -48,7 +50,7 @@
{% else %}
<li>
<span class="breadcrumbs--ellipsed-item">
- {% trans "Add new attribute" context "Attribute detail breadcrumbs" %}
+ {% trans "Add new price for country" context "Attribute detail breadcrumbs" %}
</span>
</li>
{% endif %}
@@ -79,14 +81,14 @@
</div>
<div class="card-action right-align">
{% if value.pk %}
- <a href="{% url 'dashboard:shipping-method-detail' pk=shipping_method_pk %}" class="btn btn-flat">
+ <a href="{% url 'dashboard:shipping-method-detail' pk=shipping_method.pk %}" class="btn btn-flat">
{% trans "Cancel" context "Dashboard cancel action" %}
</a>
<button type="submit" class="btn waves-effect waves-light">
{% trans "Save" context "Dashboard update action" %}
</button>
{% else %}
- <a href="{% url 'dashboard:shipping-method-detail' pk=shipping_method_pk %}" class="btn btn-flat">
+ <a href="{% url 'dashboard:shipping-method-detail' pk=shipping_method.pk %}" class="btn btn-flat">
{% trans "Cancel" context "Dashboard cancel action" %}
</a>
<button type="submit" class="btn waves-effect waves-light">
diff --git a/templates/dashboard/shipping/form.html b/templates/dashboard/shipping/form.html
index 99fe1a381e..b7da12241b 100644
--- a/templates/dashboard/shipping/form.html
+++ b/templates/dashboard/shipping/form.html
@@ -54,7 +54,7 @@
<span class="breadcrumbs--ellipsed-item">
{% trans "Add new method" context "Shipping method form breadcrumbs" %}
</span>
- <li>
+ </li>
{% endif %}
</ul>
{% endblock %}
diff --git a/templates/dashboard/sites/detail.html b/templates/dashboard/sites/detail.html
index b5a256f62a..adc930def8 100644
--- a/templates/dashboard/sites/detail.html
+++ b/templates/dashboard/sites/detail.html
@@ -14,7 +14,7 @@
<ul class="breadcrumbs breadcrumbs--history">
<li>
<span class="breadcrumbs--elipsed-item">
- {{ site }}
+ Site settings
</span>
</li>
</ul>
diff --git a/templates/dashboard/sites/form.html b/templates/dashboard/sites/form.html
index 2f5ec31379..0fd79e03eb 100644
--- a/templates/dashboard/sites/form.html
+++ b/templates/dashboard/sites/form.html
@@ -17,8 +17,15 @@
{% block breadcrumbs %}
<ul class="breadcrumbs breadcrumbs--history">
- <li class="visible-s">
- {% trans "Edit site settings" context "Dashboard site settings" %}
+ <li>
+ <a href="{% url 'dashboard:site-index' %}" class="breadcrumbs--ellipsed-item">
+ {% trans "Site settings" context "Dashboard attributes list" %}
+ </a>
+ </li>
+ <li>
+ <span>
+ {% trans "Edit" context "Dashboard site settings" %}
+ </span>
</li>
</ul>
{% endblock %}