Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix category table when no subcategories
michal95a07908e116
diff --git a/templates/dashboard/category/list.html b/templates/dashboard/category/list.htmlindex 6fe4674bef..465be2a213 100644--- a/templates/dashboard/category/list.html+++ b/templates/dashboard/category/list.html@@ -101,8 +101,8 @@<a class="btn btn-flat modal-trigger-custom"data-href="{% url 'dashboard:category-delete' pk=root.pk %}"href="#base-modal">- {% trans "Remove category" context "Category list action link" %}- </a>+ {% trans "Remove category" context "Category list action link" %}+ </a></div>{% endif %}</div>@@ -112,74 +112,64 @@<div class="row"><div class="col s12 l9">- {% if categories %}- <div class="card">- <div class="data-table-header-action">- <a href="{% if root%}{% url 'dashboard:category-add' root_pk=root.pk %}{% else %}{% url 'dashboard:category-add' %}{% endif %}" class="btn-data-table btn btn-flat">- {% trans "Add" %}- </a>- </div>- <div class="data-table-container">- <table class="bordered highlight responsive data-table data-table-description">- <thead>- <tr>- {% get_sort_by_toggle 'name' as toggle %}- <th class="{% if toggle.is_active %}active{% endif %}">- <a href="{{ toggle.url }}">- <svg data-src="{{ toggle.sorting_icon }}" />- {% trans "Name" context "Category list table header name" %}+ <div class="card">+ <div class="data-table-header-action">+ <a href="{% if root%}{% url 'dashboard:category-add' root_pk=root.pk %}{% else %}{% url 'dashboard:category-add' %}{% endif %}" class="btn-data-table btn btn-flat">+ {% trans "Add" %}+ </a>+ </div>+ <div class="data-table-container">+ <table class="bordered highlight responsive data-table data-table-description">+ <thead>+ <tr>+ {% get_sort_by_toggle 'name' as toggle %}+ <th class="{% if toggle.is_active %}active{% endif %}">+ <a href="{{ toggle.url }}">+ <svg data-src="{{ toggle.sorting_icon }}" />+ {% trans "Name" context "Category list table header name" %}+ </a>+ </th>+ {% get_sort_by_toggle 'description' as toggle %}+ <th class="wide {% if toggle.is_active %}active{% endif %}">+ <a href="{{ toggle.url }}">+ <svg data-src="{{ toggle.sorting_icon }}" />+ {% trans "Description" context "Category list table header description" %}+ </a>+ </th>+ </thead>+ <tbody>+ {% for node in categories %}+ <tr data-action-go="{% url 'dashboard:category-list' root_pk=node.pk %}">+ <td>+ {{ node.name }}+ </td>+ <td class="nowrap">+ {% if node.description %}+ {{ node.description }}+ {% else %}+ + {% endif %}+ </td>+ <td class="right-align">+ <a href="{% url 'dashboard:category-edit' root_pk=node.pk %}" class="btn btn-flat">+ {% trans 'Edit' context 'Category edit action' %}</a>- </th>- {% get_sort_by_toggle 'description' as toggle %}- <th class="wide {% if toggle.is_active %}active{% endif %}">- <a href="{{ toggle.url }}">- <svg data-src="{{ toggle.sorting_icon }}" />- {% trans "Description" context "Category list table header description" %}+ <a class="btn btn-flat modal-trigger-custom"+ data-href="{% url 'dashboard:category-delete' pk=node.pk %}"+ href="#base-modal">+ {% trans "Remove" context "Category list action link" %}</a>- </th>- </tr>- </thead>- <tbody>- {% for node in categories %}- <tr data-action-go="{% url "dashboard:category-list" root_pk=node.pk %}">- <td>- {{ node.name }}- </td>- <td class="nowrap">- {% if node.description %}- {{ node.description }}- {% else %}- - {% endif %}- </td>- <td class="right-align">- <a href="{% url 'dashboard:category-edit' root_pk=node.pk %}" class="btn btn-flat">- {% trans 'Edit' context 'Category edit action' %}- </a>- <a class="btn btn-flat modal-trigger-custom" href="#base-modal" data-href="{% url 'dashboard:category-delete' pk=node.pk %}">- {% trans 'Remove' context 'Category remove action' %}- </a></td>- </tr>- {% endfor %}- </tbody>- </table>- </div>- </div>- {% paginate categories %}- {% else %}- <div class="not-found">- {% if root %}- <p class="grey-text">- {% trans "No subcategories." context "Empty Category list message" %}- </p>- {% else %}- <p class="grey-text">- {% trans "No categories." context "Empty Category list message" %}- </p>- {% endif %}- </div>- {% endif %}+ </tr>+ {% empty %}+ <tr>+ <td colspan="2">{% trans "No categories" context "Empty list of categories" %}</td>+ </tr>+ {% endfor %}+ </tbody>+ </table>+ </div>+ {% paginate categories %}</div></div>{% endblock %}