Skip to content

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

Add brdcrmbs to header, improve product form

Paweł Kowalewski5fbb1e7a13d6
diff --git a/saleor/dashboard/templates/dashboard/base.html b/saleor/dashboard/templates/dashboard/base.html
index 0014840f35..db8dcffb8c 100644
--- a/saleor/dashboard/templates/dashboard/base.html
+++ b/saleor/dashboard/templates/dashboard/base.html
@@ -20,8 +20,14 @@
<nav class="top-nav">
<div class="container">
<div class="nav-wrapper">
- <span class="page-title">{% block page_title %}{% trans "Dashboard" %}{% endblock %}</span>
- <a href="#" data-activates="side-menu" class="button-collapse"><i class="mdi-navigation-menu"></i></a>
+ {% block header_menu %}
+ <a href="#" data-activates="side-menu" class="button-collapse header-button"><i class="mdi-navigation-menu"></i></a>
+ {% endblock %}
+ {% block breadcrumbs %}
+ <ul class="breadcrumbs">
+ <li>{% trans "Dashboard" %}</li>
+ </ul>
+ {% endblock %}
{% block header_extra %}{% endblock %}
</div>
</div>
diff --git a/saleor/dashboard/templates/dashboard/product/list.html b/saleor/dashboard/templates/dashboard/product/list.html
index dfdfd99b8b..d96eb9cdb5 100644
--- a/saleor/dashboard/templates/dashboard/product/list.html
+++ b/saleor/dashboard/templates/dashboard/product/list.html
@@ -8,13 +8,19 @@
{% block body_class %}body-products{% endblock %}
-{% block page_title %}{% trans "Products" %}{% endblock %}
-
{% block header_extra %}
- <a class="btn-fab btn-floating btn-large waves-effect waves-light teal modal-trigger"
- href="#modal-product-class" title="{% trans "Add product" %}">
- <i class="mdi-content-add"></i>
- </a>
+ <div class="fixed-action-btn">
+ <a class="btn-fab btn-floating btn-large waves-effect waves-light teal modal-trigger"
+ href="#modal-product-class" title="{% trans "Add product" %}">
+ <i class="mdi-content-add"></i>
+ </a>
+ </div>
+{% endblock %}
+
+{% block breadcrumbs %}
+ <ul class="breadcrumbs">
+ <li>{% trans "Products" %}</li>
+ </ul>
{% endblock %}
{% block content %}
diff --git a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
index 851d64d0d1..6ee61888c5 100644
--- a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
@@ -30,7 +30,7 @@
<div class="row">
<div class="col m6 l4 offset-m3 offset-l4 right-align">
- <a href="{% url 'dashboard:products' %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>
+ <a href="{% url 'dashboard:product-update' pk=object.pk %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>
<button type="submit" class="btn materialize-red"><i class="mdi-action-delete"></i> {% trans "Delete" %}</button>
</div>
</div>
diff --git a/saleor/dashboard/templates/dashboard/product/product_form.html b/saleor/dashboard/templates/dashboard/product/product_form.html
index db7316f410..545d748f17 100644
--- a/saleor/dashboard/templates/dashboard/product/product_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_form.html
@@ -10,6 +10,32 @@
{% block page_title %}{{ title }}{% endblock %}
+{% block header_menu %}
+ <a href="{% url "dashboard:products" %}" class="header-button"><i class="mdi-navigation-arrow-back"></i></a>
+{% endblock %}
+
+{% block header_extra %}
+ {% if product.pk %}
+ <a class="dropdown-button" href="#" data-activates="product-delete">
+ <i class="mdi-navigation-more-vert"></i>
+ </a>
+ <ul id="product-delete" class="dropdown-content">
+ <li>
+ <a href="{% url "dashboard:product-delete" pk=product.pk %}">
+ {% trans "Remove" %}
+ </a>
+ </li>
+ </ul>
+ {% endif %}
+{% endblock %}
+
+{% block breadcrumbs %}
+ <ul class="breadcrumbs breadcrumbs--with-menu">
+ <li><a href="{% url "dashboard:products" %}">{% trans "Products" %}</a></li>
+ <li><i class="mdi-navigation-chevron-right"></i> {{ title }}</li>
+ </ul>
+{% endblock %}
+
{% block content %}
<form method="post" id="product-form" enctype="multipart/form-data">
<div class="row" hidden>
@@ -36,24 +62,37 @@
{% endif %}
<div class="row" id="details">
- <div class="col l8 offset-l2">
- <div class="row" id="form-product">
+ <div id="form-product">
+ <div class="col l8" >
+ <div class="row">
{% csrf_token %}
- {{ product_form|materializecss }}
+ {{ product_form.name|materializecss }}
+ {{ product_form.description|materializecss }}
+ </div>
+ </div>
+
+ <div class="col l4"><div class="row">
+ {{ product_form.price|materializecss }}
+ {{ product_form.weight|materializecss }}
+ {{ product_form.collection|materializecss }}
+ {{ product_form.sku|materializecss:"s12 m6" }}
+ {{ product_form.categories|materializecss:"input-field s12" }}
+ </div>
</div>
<div class="row">
<div class="col s12 right-align">
- <a href="{% url 'dashboard:products' %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>
+
{% if product.pk %}
- <button type="submit" name="product-form" class="btn"><i class="mdi-content-save"></i> {% trans "Update" %}</button>
+ <button type="submit" name="product-form" class="btn">{% trans "Update" %}</button>
{% else %}
- <button type="submit" name="product-form" class="btn"><i class="mdi-content-create"></i> {% trans "Create" %}</button>
+ <button type="submit" name="product-form" class="btn">{% trans "Create" %}</button>
{% endif %}
</div>
</div>
</div>
</div>
+ </div>
</form>
{% if product.pk %}
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index 53b8754b89..46e8f7ef0d 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -2,31 +2,7 @@ $roboto-font-path: "../fonts/";
$icons-font-path: $roboto-font-path;
$font-size-action-icon: 18px;
-
-/**
- * @license
- * MyFonts Webfont Build ID 2917526, 2014-11-07T07:08:31-0500
- *
- * The fonts listed in this notice are subject to the End User License
- * Agreement(s) entered into by the website owner. All other parties are
- * explicitly restricted from using the Licensed Webfonts(s).
- *
- * You may obtain a valid license at the URLs below.
- *
- * Webfont: HurmeGeometricSans4-Black by Hurme Design
- * URL: http://www.myfonts.com/fonts/hurme-design/hurme-geometric-sans-4/4-black/
- *
- *
- * License: http://www.myfonts.com/viewlicense?type=web&buildid=2917526
- * Licensed pageviews: 10,000
- * Webfonts copyright: Copyright (c) 2012 by Toni Hurme. All rights reserved.
- *
- * © 2014 MyFonts Inc
-*/
-
-/* @import must be at top of file, otherwise CSS will not work */
-@import url("//hello.myfonts.net/count/2c8496");
-@font-face {font-family: "HurmeGeometricSans4-Black";src: url("#{$roboto-font-path}2C8496_1_0.eot");src: url("#{$roboto-font-path}2C8496_1_0.eot?#iefix") format("embedded-opentype"),url("#{$roboto-font-path}2C8496_1_0.woff2") format("woff2"),url("#{$roboto-font-path}2C8496_1_0.woff") format("woff"),url("#{$roboto-font-path}2C8496_1_0.ttf") format("truetype");}
+$header-height: 60px;
@import "materialize/sass/materialize";
@import "select2/src/scss/core";
@@ -38,25 +14,42 @@ $font-size-action-icon: 18px;
.top-nav {
box-shadow: none;
- height: 100px;
+ height: $header-height;
margin-bottom: $gutter-width;
.container {
height: 100%;
}
- .button-collapse {
+ .header-button {
+ float: left;
margin-right: $gutter-width;
+ @media (min-width: $medium-screen-up) {
+ display: none;
+ }
+
i {
- height: 100px;
- line-height: 100px;
+ font-size: 2.7rem;
+ height: $header-height;
+ line-height: $header-height;
+ }
+ }
+
+ .dropdown-button {
+ float: right;
+ line-height: $header-height/2;
+ position: relative;
+ top: $header-height/4;
+
+ i {
+ line-height: $header-height/2;
}
}
}
.side-nav {
- padding-top: 100px;
+ padding-top: $header-height;
li {
display: block;
@@ -79,6 +72,7 @@ $font-size-action-icon: 18px;
}
&.brand-logo {
+ padding-top: 4px;
top: 0;
width: 100%;
@@ -93,8 +87,8 @@ $font-size-action-icon: 18px;
a {
font-family: "HurmeGeometricSans4-Black", sans-serif;
font-size: 36px;
- height: 100px;
- line-height: 100px;
+ height: $header-height;
+ line-height: $header-height;
letter-spacing: -4px;
letter-spacing: -.5vmin;
margin-left: -4px;
@@ -119,7 +113,7 @@ $font-size-action-icon: 18px;
i {
vertical-align: inherit;
width: auto;
- margin: 5px;
+ margin: 0 5px;
&:last-child {
margin-right: 0;
@@ -130,6 +124,9 @@ $font-size-action-icon: 18px;
ul ul {
li {
a {
+ background: map-get($grey, lighten-5);
+ height: 52px;
+ line-height: 52px;
padding-left: 30px;
}
}
@@ -158,8 +155,8 @@ $font-size-action-icon: 18px;
.page-title {
display: block;
- font-size: 36px;
- line-height: 100px;
+ font-size: $h5-fontsize;
+ line-height: $header-height;
@media (max-width: $medium-screen) {
float: right;
@@ -183,12 +180,6 @@ table {
}
}
-.btn-fab {
- position: absolute;
- bottom: -$button-floating-size*1.5/2;
- right: 0;
-}
-
#id_price {
float: left;
width: calc(100% - 40px);
@@ -203,6 +194,10 @@ table {
#id_name {
@extend %input-lg;
}
+
+ #id_price {
+ @extend %input-lg;
+ }
}
.input-text-suffix {
@@ -220,6 +215,7 @@ table {
color: #999;
}
+@import "widget/breadcrumbs";
@import "widget/category-list";
@import "widget/form";
@import "widget/product-gallery";
diff --git a/saleor/static/scss/widget/_breadcrumbs.scss b/saleor/static/scss/widget/_breadcrumbs.scss
new file mode 100644
index 0000000000..9fd7bba869
--- /dev/null
+++ b/saleor/static/scss/widget/_breadcrumbs.scss
@@ -0,0 +1,49 @@
+@mixin breadcrumbs {
+ color: map-get($materialize-red, lighten-3);
+ display: block;
+ float: left;
+ font-size: $h5-fontsize;
+ line-height: $header-height;
+ white-space: nowrap;
+
+ @media (max-width: $medium-screen) {
+ width: calc(100% - 38px - 1.5rem);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ li {
+ display: inline-block;
+ float: none;
+ line-height: $header-height/2;
+
+ &:hover {
+ background: none;
+ }
+
+ a {
+ font-size: $h5-fontsize;
+ padding: 0;
+ }
+
+ i {
+ display: inline-block;
+ height: auto;
+ line-height: 1;
+ vertical-align: bottom;
+ }
+ }
+
+ &--with-menu {
+ width: calc(100% - 38px - 1.5rem);
+
+ @media (max-width: $medium-screen) {
+ width: calc(100% - 76px - 3rem);
+ }
+ }
+}
+
+.breadcrumbs {
+ @include breadcrumbs;
+}
diff --git a/saleor/static/scss/widget/_select2.scss b/saleor/static/scss/widget/_select2.scss
index 63fe21de14..4cf4c038ec 100644
--- a/saleor/static/scss/widget/_select2.scss
+++ b/saleor/static/scss/widget/_select2.scss
@@ -3,10 +3,11 @@
&--default, &--default.select2-container--focus {
.select2-selection--multiple {
+ background: transparent;
border: none;
border-bottom: 1px solid $input-border-color;
border-radius: 0;
- line-height: 3rem;
+ line-height: calc(3rem - 1px);
.select2-selection__rendered {
padding: 0;
@@ -14,6 +15,8 @@
}
.select2-selection__choice {
+ background-color: map_get($blue, lighten-4);
+ border-color: map-get($blue, lighten-3);
line-height: 1.5;
margin-top: 10px;
}
@@ -21,8 +24,10 @@
.select2-search--inline {
.select2-search__field {
+ background: transparent;
height: auto;
margin: 0;
+ padding-left: 0;
&:focus {
border-bottom: none;
@@ -34,6 +39,10 @@
&--default.select2-container--open {
@extend .z-depth-1;
+
+ .select2-selection__rendered {
+ background-color: white;
+ }
}
.select2-dropdown {