Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve category management templates
Paweł Kowalewski05adca978349
diff --git a/saleor/dashboard/templates/dashboard/category/detail.html b/saleor/dashboard/templates/dashboard/category/detail.htmlindex b45700dd52..fda92848e4 100644--- a/saleor/dashboard/templates/dashboard/category/detail.html+++ b/saleor/dashboard/templates/dashboard/category/detail.html@@ -12,20 +12,21 @@{% block content %}<form method="post" id="category-form" enctype="multipart/form-data"><div class="row">- <div class="col l8">- <div class="form-message alert alert-success" hidden="hidden">- <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>- <span class="glyphicon glyphicon-ok-sign"></span>- <span class="message-content">{% trans "Data saved" %}</span>+ <div class="col l8 offset-l2">+ <div class="row">+ {% csrf_token %}+ {{ form|materializecss }}</div>- {% csrf_token %}- {{ form|materializecss }}</div></div><div class="row">- <div class="col l8 right-align">- {% if category.pk %}- <a href="{% url 'dashboard:category-delete' pk=category.pk %}" class="btn btn-flat"><i class="mdi-action-delete"></i> {% trans "Delete" %}</a>+ <div class="col l8 offset-l2 right-align">+ {% if parent_pk %}+ <a href="{% url 'dashboard:categories' root=parent_pk %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>+{# {% elif category.pk %}#}+{# <a href="{% url 'dashboard:categories' root=category.pk %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>#}+ {% else %}+ <a href="{% url 'dashboard:categories' %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>{% endif %}{% if category.pk %}<button type="submit" class="btn"><i class="mdi-content-save"></i> {% trans "Update" %}</button>diff --git a/saleor/dashboard/templates/dashboard/category/list.html b/saleor/dashboard/templates/dashboard/category/list.htmlindex d81c6aebab..5d7acb18ab 100644--- a/saleor/dashboard/templates/dashboard/category/list.html+++ b/saleor/dashboard/templates/dashboard/category/list.html@@ -6,46 +6,48 @@{% block body_class %}body-categories{% endblock %}-{% block page_title %}{% trans "Categories" %}{% endblock %}+{% block page_title %}{% trans "Categories" %}{% if current_node %}: {{ current_node }}{% endif %}{% endblock %}{% block header_extra %}- <a class="btn-fab btn-floating btn-large waves-effect waves-light teal" href="{% url 'dashboard:category-add' %}">+ <a class="btn-fab btn-floating btn-large waves-effect waves-light teal" title="{% trans "Add category" %}"+ href="{% if current_node %}{% url 'dashboard:category-add' parent_pk=current_node.pk %}{% else %}{% url 'dashboard:category-add' %}{% endif %}"><i class="mdi-content-add"></i></a>{% endblock %}{% block content %}- <div class="row">- <div class="col-lg-12">- <h1 class="page-header">{% trans "Categories" %}{% if current_node %}: {{ current_node }}{% endif %}</h1>-- {% if current_node %}- <h6>- <a href="{% url 'dashboard:categories' %}">Root</a>+ <div class="row">+ <div class="col s12">{% for item in category_breadcrumbs %}{% if forloop.last %}- <span> / {{ item.name }}</span>+ <span>{% if not forloop.first %} / {% endif %}{{ item.name }}</span>{% else %}- <span> / <a href="{% url 'dashboard:categories' root=item.pk %}">{{ item.name }}</a></span>+ <span>{% if not forloop.first %} / {% endif %}<a href="{% url 'dashboard:categories' root=item.pk %}">{{ item.name }}</a></span>{% endif %}{% endfor %}- </h6>- {% endif %}- <a class="btn btn-default" href="{% if current_node %}{% url 'dashboard:category-add' parent_pk=current_node.pk %}{% else %}{% url 'dashboard:category-add' %}{% endif %}">{% trans 'Add category' %}</a>- <ul class="category-list">- {% recursetree categories %}- <li>- {% if node.level == min_level %}<a href="{% url 'dashboard:categories' root=node.pk %}">{{ node.name }}</a>{% else %}{{ node.name }}{% endif %}- <small><a href="{% url 'dashboard:category-update' pk=node.pk %}">Edit</a></small>- {% if not node.is_leaf_node %}- <ul class="children">+ <ul class="collection category-list">+ {% recursetree categories %}+ <li class="collection-item category-list-item">+ {% if node.level == min_level %}<a href="{% url 'dashboard:categories' root=node.pk %}">{{ node.name }}</a>{% else %}{{ node.name }}{% endif %}++ <div class="right category-list-item-actions">+ <a href="{% url 'dashboard:category-add' parent_pk=node.pk %}" title="{% trans "Add child" %}">+ <i class="mdi-content-add teal-text"></i>+ </a>+ <a href="{% url 'dashboard:category-update' pk=node.pk %}" title="{% trans "Edit category" %}">+ <i class="mdi-content-create light-blue-text lighten-2"></i>+ </a>+ <a href="{% url 'dashboard:category-delete' pk=node.pk %}" title="{% trans "Delete category" %}">+ <i class="mdi-action-delete materialize-red-text"></i>+ </a>+ </div>+ </li>+ {% if not node.is_leaf_node %}{{ children }}- </ul>- {% endif %}- </li>- {% endrecursetree %}- </ul>- </div>- </div>-{% endblock %}+ {% endif %}+ {% endrecursetree %}+ </ul>+ </div>+ </div>+{% endblock %}{% if current_node %}: {{ current_node }}{% endif %}diff --git a/saleor/dashboard/templates/dashboard/product/list.html b/saleor/dashboard/templates/dashboard/product/list.htmlindex 42dbf3e078..dfdfd99b8b 100644--- a/saleor/dashboard/templates/dashboard/product/list.html+++ b/saleor/dashboard/templates/dashboard/product/list.html@@ -12,7 +12,7 @@{% block header_extra %}<a class="btn-fab btn-floating btn-large waves-effect waves-light teal modal-trigger"- href="#modal-product-class">+ href="#modal-product-class" title="{% trans "Add product" %}"><i class="mdi-content-add"></i></a>{% endblock %}@@ -33,7 +33,7 @@</a><p class="product-list-name">{{ product.collection }}</p><p class="secondary-content product-list-price">{% gross product.price %}</p>- <a href="{% url 'dashboard:product-delete' pk=product.pk %}"+ <a href="{% url 'dashboard:product-delete' pk=product.pk %}" title="{% trans "Delete product" %}"class="secondary-content materialize-red-text text-lighten-2 product-list-item-delete"><i class="mdi-action-delete"></i></a></li>{% endfor %}diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.htmlindex e2e39c23cb..9c28e1c8d1 100644--- a/saleor/dashboard/templates/dashboard/product/product_form.html+++ b/saleor/dashboard/templates/dashboard/product/product_form.html@@ -151,11 +151,11 @@{% if image.alt %}<span class="product-gallery-item-text">{{ image.alt }}</span>{% endif %}- <a class="product-gallery-item-create light-blue-text text-lighten-1"+ <a class="product-gallery-item-create light-blue-text text-lighten-1" title="{% trans "Edit image" %}"href="{% url 'dashboard:product-image-update' product_pk=product.pk img_pk=image.pk %}"><i class="mdi-content-create"></i></a>- <a class="product-gallery-item-remove materialize-red-text text-lighten-2"+ <a class="product-gallery-item-remove materialize-red-text text-lighten-2" title="{% trans "Delete image" %}"href="{% url 'dashboard:product-image-delete' product_pk=product.pk img_pk=image.pk %}"><i class="mdi-action-delete"></i></a>diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scssindex 1fcc55cd66..2f37d65363 100644--- a/saleor/static/scss/_app.scss+++ b/saleor/static/scss/_app.scss@@ -45,6 +45,10 @@ $font-size-action-icon: 18px;height: 100px;margin-bottom: $gutter-width;+ .container {+ height: 100%;+ }+.button-collapse {margin-right: $gutter-width;@@ -157,8 +161,17 @@ $font-size-action-icon: 18px;}.page-title {+ display: block;font-size: 36px;line-height: 100px;++ @media (max-width: $medium-screen) {+ float: right;+ width: calc(100% - 38px - 1.5rem);+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }}table {@@ -200,6 +213,7 @@ table {color: #999;}+@import "widget/category-list";@import "widget/form";@import "widget/product-gallery";@import "widget/product-list";diff --git a/saleor/static/scss/dashboard.scss b/saleor/static/scss/dashboard.scssindex 9bc6322926..78d17dd03e 100644--- a/saleor/static/scss/dashboard.scss+++ b/saleor/static/scss/dashboard.scss@@ -1,6 +1 @@@import "app";-.category-list {- ul {- padding-left: 25px;- }-}diff --git a/saleor/static/scss/widget/_category-list.scss b/saleor/static/scss/widget/_category-list.scssnew file mode 100644index 0000000000..5a44d8cec0--- /dev/null+++ b/saleor/static/scss/widget/_category-list.scss@@ -0,0 +1,37 @@+@mixin category-list {+ &-item {+ &-actions {+ font-size: $font-size-action-icon;++ @media (min-width: $medium-screen-up) {+ display: none;+ }+ }++ &:hover {+ .category-list-item-actions {+ @media (min-width: $medium-screen-up) {+ display: block;+ }+ }+ }+ }++ ul {+ li {+ .collapsible-header {+ padding-left: 2rem;+ }++ &:last-child {+ .collapsible-header {+ border-bottom: none;+ }+ }+ }+ }+}++.category-list {+ @include category-list;+}