Skip to content

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

Add category detail view

michald02f7d59bb0f
diff --git a/saleor/dashboard/category/views.py b/saleor/dashboard/category/views.py
index 7828c6714c..3d54b378fd 100644
--- a/saleor/dashboard/category/views.py
+++ b/saleor/dashboard/category/views.py
@@ -51,7 +51,7 @@ def category_create(request, root_pk=None):
else:
return redirect('dashboard:category-list')
ctx = {'category': category, 'form': form}
- return TemplateResponse(request, 'dashboard/category/detail.html', ctx)
+ return TemplateResponse(request, 'dashboard/category/form.html', ctx)
@staff_member_required
@@ -74,7 +74,7 @@ def category_edit(request, root_pk=None):
elif form.errors:
status = 400
ctx = {'category': category, 'form': form, 'status': status}
- template = 'dashboard/category/modal/edit.html'
+ template = 'dashboard/category/form.html'
return TemplateResponse(request, template, ctx, status=status)
diff --git a/templates/dashboard/category/detail.html b/templates/dashboard/category/form.html
similarity index 100%
rename from templates/dashboard/category/detail.html
rename to templates/dashboard/category/form.html
diff --git a/templates/dashboard/category/list.html b/templates/dashboard/category/list.html
index 805d530d51..6fe4674bef 100644
--- a/templates/dashboard/category/list.html
+++ b/templates/dashboard/category/list.html
@@ -26,42 +26,6 @@
{% endif %}
{% endblock %}
-{% block header_extra %}
- {% if perms.product.edit_category %}
- <div class="fixed-action-btn">
- <a class="btn-fab btn-floating btn-large waves-effect waves-light"
- title="{% trans "Add category" context "Category list add button text" %}"
- href="
- {% if root %}{% url 'dashboard:category-add' root_pk=root.pk %}{% else %}{% url 'dashboard:category-add' %}{% endif %}">
- <svg data-src="{% static "dashboard/images/add.svg" %}"/>
- </a>
- </div>
- {% if root %}
- <a class="dropdown-button right" href="#" data-activates="category-delete"
- data-constrainwidth="false">
- <svg data-src="{% static "dashboard/images/more_vert.svg" %}" height="24"
- width="24"/>
- </a>
- <ul id="category-delete" class="dropdown-content">
- <li>
- <a class="modal-trigger-custom"
- data-href="{% url 'dashboard:category-edit' root_pk=root.pk %}"
- href="#base-modal">
- {% trans "Edit category" context "Dashboard edit action" %}
- </a>
- </li>
- <li>
- <a class="modal-trigger-custom"
- data-href="{% url 'dashboard:category-delete' pk=root.pk %}"
- href="#base-modal">
- {% trans "Remove category" context "Category list action link" %}
- </a>
- </li>
- </ul>
- {% endif %}
- {% endif %}
-{% endblock %}
-
{% block breadcrumbs %}
<ul class="breadcrumbs breadcrumbs--history">
{% if path %}
@@ -108,10 +72,53 @@
{% block menu_catalogue_class %} active{% endblock %}
{% block content %}
+ {% if root %}
+ <div class="row">
+ <div class="col m12">
+ <div class="card">
+ <div class="card-content">
+ <span class="card-title">
+ {{ root.name }}
+ </span>
+ <div class="row">
+ {% if root.description %}
+ <div class="col s12 m4 l12">
+ <h4>
+ {% trans "Description" context "Shipping method field" %}
+ </h4>
+ <p>
+ {{ root.description }}
+ </p>
+ </div>
+ {% endif %}
+ </div>
+ </div>
+ {% if perms.product.edit_category %}
+ <div class="card-action">
+ <a class="btn btn-flat" href="{% url 'dashboard:category-edit' root_pk=root.pk %}">
+ {% trans "Edit shipping method" context "Shipping method action" %}
+ </a>
+ <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>
+ </div>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ {% endif %}
+
<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>
@@ -145,6 +152,14 @@
&nbsp;
{% 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>
diff --git a/templates/dashboard/category/modal/edit.html b/templates/dashboard/category/modal/edit.html
deleted file mode 100644
index 770219d468..0000000000
--- a/templates/dashboard/category/modal/edit.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{% load materializecss %}
-{% load i18n %}
-{% load mptt_tags %}
-
-<form method="post" id="form-category" class="form-async" action="{% url "dashboard:category-edit" root_pk=category.pk %}" novalidate>
- {% csrf_token %}
- <div class="modal-content">
- <div class="row">
- <div class="col s12">
- <h5>
- {% blocktrans trimmed context "Edit category modal title" %}
- Edit {{ category }}
- {% endblocktrans %}
- </h5>
- </div>
- </div>
- <div class="row">
- {{ form.name|materializecss:"s8 m10" }}
- {{ form.hidden|materializecss:"s4 m2" }}
- {{ form.description|materializecss }}
- </div>
- </div>
- <div class="modal-footer">
- <a href="#!" class="modal-action modal-close btn-flat">
- {% trans "Cancel" context "Dashboard cancel action" %}
- </a>
- <button type="submit" class="modal-action btn-flat">
- {% trans "Update" context "Dashboard update action" %}
- </button>
- </div>
-</form>