Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix tests and templates
michald0c07d298d57
diff --git a/saleor/dashboard/category/views.py b/saleor/dashboard/category/views.pyindex 8212e2a6ec..aa4354dda8 100644--- a/saleor/dashboard/category/views.py+++ b/saleor/dashboard/category/views.py@@ -38,6 +38,8 @@ def category_list(request, root_pk=None):@staff_member_required@permission_required('product.edit_category')def category_create(request, root_pk=None):+ root = None+ path = Nonecategory = Category()if root_pk:root = get_object_or_404(Category, pk=root_pk)@@ -60,6 +62,8 @@ def category_create(request, root_pk=None):@staff_member_required@permission_required('product.edit_category')def category_edit(request, root_pk=None):+ root = None+ path = Nonecategory = get_object_or_404(Category, pk=root_pk)if root_pk:root = get_object_or_404(Category, pk=root_pk)diff --git a/templates/dashboard/category/form.html b/templates/dashboard/category/form.htmlindex d7aae8158f..85a45fd4a1 100644--- a/templates/dashboard/category/form.html+++ b/templates/dashboard/category/form.html@@ -103,9 +103,15 @@</div></div><div class="card-action right-align">- <a href="{% url 'dashboard:category-detail' pk=path.last.pk %}" class="btn btn-flat">- {% trans "Cancel" context "Dashboard cancel action" %}- </a>+ {% if path %}+ <a href="{% url 'dashboard:category-detail' pk=path.last.pk %}" class="btn btn-flat">+ {% trans "Cancel" context "Dashboard cancel action" %}+ </a>+ {% else %}+ <a href="{% url 'dashboard:category-list' %}" class="btn btn-flat">+ {% trans "Cancel" context "Dashboard cancel action" %}+ </a>+ {% endif %}{% if category.pk %}<button type="submit" class="btn waves-effect waves-light">{% trans "Update" context "Dashboard update action" %}diff --git a/templates/dashboard/category/list.html b/templates/dashboard/category/list.htmlindex 517b2ff81d..d2570c82cc 100644--- a/templates/dashboard/category/list.html+++ b/templates/dashboard/category/list.html@@ -70,14 +70,6 @@{% trans "Categories" context "Dashboard categories list" %}</a></li>- {% else %}- <li class="visible-s">- <span>- {% trans "Categories" context "Dashboard categories list" %}- </span>- </li>- {% endif %}- {% if path %}<li class="back-mobile"><a href="{% url 'dashboard:category-list' %}"><svg data-src="{% static "dashboard/images/arrow_left.svg" %}" fill="#fff"@@ -101,6 +93,12 @@</li>{% endif %}{% endfor %}+ {% else %}+ <li class="visible-s">+ <span>+ {% trans "Categories" context "Dashboard categories list" %}+ </span>+ </li>{% endif %}</ul>{% endblock %}@@ -137,7 +135,7 @@</thead><tbody>{% for node in categories %}- <tr data-action-go="{% url 'dashboard:category-list' root_pk=node.pk %}">+ <tr data-action-go="{% url 'dashboard:category-detail' pk=node.pk %}"><td>{{ node.name }}</td>@@ -159,10 +157,11 @@</a></td></tr>- </tbody>- </table>- </div>+ {% endfor %}+ </tbody>+ </table></div>+ </div>{% paginate categories %}</div></div>