Skip to content

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

Add active class for navigation

Paweł Kowalewski64828725be58
diff --git a/saleor/dashboard/templates/dashboard/base.html b/saleor/dashboard/templates/dashboard/base.html
index 65f25b673d..0014840f35 100644
--- a/saleor/dashboard/templates/dashboard/base.html
+++ b/saleor/dashboard/templates/dashboard/base.html
@@ -15,7 +15,7 @@
{% endblock %}
</head>
-<body>
+<body class="{% block body_class %}body-home{% endblock %}">
<header class="header">
<nav class="top-nav">
<div class="container">
@@ -43,12 +43,12 @@
</ul>
</li>
<li class="brand-logo"><a href="{% url 'dashboard:index' %}">Saleor</a></li>
- <li><a href="{% url 'dashboard:index' %}" class="waves-effect waves-teal">Home</a></li>
- <li><a href="{% url 'dashboard:orders' %}" class="waves-effect waves-teal">Orders</a></li>
- <li><a href="{% url 'dashboard:products' %}" class="waves-effect waves-teal">Products</a></li>
- <li><a href="{% url 'dashboard:categories' %}" class="waves-effect waves-teal">Categories</a></li>
- <li><a href="{% url 'dashboard:customers' %}" class="waves-effect waves-teal">Customers</a></li>
- <li><a href="{% url 'dashboard:payments' %}" class="waves-effect waves-teal">Payments</a></li>
+ <li class="nav-home"><a href="{% url 'dashboard:index' %}" class="waves-effect waves-teal">Home</a></li>
+ <li class="nav-orders"><a href="{% url 'dashboard:orders' %}" class="waves-effect waves-teal">Orders</a></li>
+ <li class="nav-products"><a href="{% url 'dashboard:products' %}" class="waves-effect waves-teal">Products</a></li>
+ <li class="nav-categories"><a href="{% url 'dashboard:categories' %}" class="waves-effect waves-teal">Categories</a></li>
+ <li class="nav-customers"><a href="{% url 'dashboard:customers' %}" class="waves-effect waves-teal">Customers</a></li>
+ <li class="nav-payments"><a href="{% url 'dashboard:payments' %}" class="waves-effect waves-teal">Payments</a></li>
</ul>
</nav>
</header>
diff --git a/saleor/dashboard/templates/dashboard/category/category_confirm_delete.html b/saleor/dashboard/templates/dashboard/category/category_confirm_delete.html
index 12f763949d..65ac115204 100644
--- a/saleor/dashboard/templates/dashboard/category/category_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/category/category_confirm_delete.html
@@ -4,6 +4,8 @@
{% block title %}{% trans "Delete category" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-categories{% endblock %}
+
{% block content %}
<form class="form form-horizontal" action="" method="post">
{% csrf_token %}
diff --git a/saleor/dashboard/templates/dashboard/category/detail.html b/saleor/dashboard/templates/dashboard/category/detail.html
index fd5c864bb0..b45700dd52 100644
--- a/saleor/dashboard/templates/dashboard/category/detail.html
+++ b/saleor/dashboard/templates/dashboard/category/detail.html
@@ -1,44 +1,37 @@
{% extends "dashboard/base.html" %}
-{% load bootstrap %}
+{% load materializecss %}
{% load i18n %}
{% load mptt_tags %}
{% block title %}{{ title }} - {% trans 'Categories' %} - {{ block.super }}{% endblock %}
-{% block content %}
- <div class="row">
- <div class="col-lg-12">
- <h1 class="page-header">{{ title }}</h1>
- </div>
- </div>
+{% block body_class %}body-categories{% endblock %}
- <form class="form form-vertical" method="post" id="category-form" enctype="multipart/form-data">
+{% block page_title %}{{ title }}{% endblock %}
+
+{% block content %}
+ <form method="post" id="category-form" enctype="multipart/form-data">
<div class="row">
- <div class="col-lg-8">
+ <div class="col l8">
<div class="form-message alert alert-success" hidden="hidden">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<span class="glyphicon glyphicon-ok-sign"></span>
<span class="message-content">{% trans "Data saved" %}</span>
</div>
{% csrf_token %}
- {{ form|as_vertical_form }}
+ {{ form|materializecss }}
</div>
</div>
<div class="row">
- <div class="col-lg-8">
- <p>
- {% if category.pk %}
- <span class="pull-right">
- <a href="{% url 'dashboard:category-delete' pk=category.pk %}" class="btn btn-danger"><i class="glyphicon glyphicon-trash"></i> {% trans "Delete" %}</a>
- </span>
- {% endif %}
- {% if category.pk %}
- <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-refresh"></i> {% trans "Update" %}</button>
- {% else %}
- <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-upload"></i> {% trans "Create" %}</button>
- {% endif %}
- <a href="{% url 'dashboard:categories' %}" class="btn btn-default"><i class="glyphicon glyphicon-remove"></i> {% trans "Cancel" %}</a>
- </p>
+ <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>
+ {% endif %}
+ {% if category.pk %}
+ <button type="submit" class="btn"><i class="mdi-content-save"></i> {% trans "Update" %}</button>
+ {% else %}
+ <button type="submit" class="btn"><i class="mdi-content-create"></i> {% trans "Create" %}</button>
+ {% endif %}
</div>
</div>
</form>
diff --git a/saleor/dashboard/templates/dashboard/category/list.html b/saleor/dashboard/templates/dashboard/category/list.html
index 4b401726cd..3468f7dbe5 100644
--- a/saleor/dashboard/templates/dashboard/category/list.html
+++ b/saleor/dashboard/templates/dashboard/category/list.html
@@ -4,6 +4,17 @@
{% block title %}{% trans "Categories" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-categories{% endblock %}
+
+{% block page_title %}{% trans "Categories" %}{% endblock %}
+
+{% block header_extra %}
+ <a class="btn-fab btn-floating btn-large waves-effect waves-light teal"
+ href="{% url 'dashboard:category-add' %}">
+ <i class="mdi-content-add"></i>
+ </a>
+{% endblock %}
+
{% block content %}
<div class="row">
<div class="col-lg-12">
diff --git a/saleor/dashboard/templates/dashboard/customer/detail.html b/saleor/dashboard/templates/dashboard/customer/detail.html
index 291ad36837..fedcc0f883 100644
--- a/saleor/dashboard/templates/dashboard/customer/detail.html
+++ b/saleor/dashboard/templates/dashboard/customer/detail.html
@@ -6,6 +6,8 @@
{% block title %}{{ customer }} - {% trans "Customers" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-customers{% endblock %}
+
{% block page_title %}<span class="mdi-action-account-circle"></span> {{ customer }}{% endblock %}
{% block content %}
diff --git a/saleor/dashboard/templates/dashboard/customer/list.html b/saleor/dashboard/templates/dashboard/customer/list.html
index a35a0150dc..0afd929bf9 100644
--- a/saleor/dashboard/templates/dashboard/customer/list.html
+++ b/saleor/dashboard/templates/dashboard/customer/list.html
@@ -7,6 +7,8 @@
{% block title %}{% trans "Customers" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-customers{% endblock %}
+
{% block page_title %}{% trans "Customers" %}{% endblock %}
{% block content %}
diff --git a/saleor/dashboard/templates/dashboard/order/address-edit.html b/saleor/dashboard/templates/dashboard/order/address-edit.html
index ac3479055b..cb723dd502 100644
--- a/saleor/dashboard/templates/dashboard/order/address-edit.html
+++ b/saleor/dashboard/templates/dashboard/order/address-edit.html
@@ -5,6 +5,8 @@
{% block title %}{% blocktrans %}Edit {{ address_type }} address{% endblocktrans %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-orders{% endblock %}
+
{% block page_title %}
{% if address_type == "shipping" %}
{% trans "Edit shipping address" %}
diff --git a/saleor/dashboard/templates/dashboard/order/detail.html b/saleor/dashboard/templates/dashboard/order/detail.html
index 92e4181c08..34fecbe794 100644
--- a/saleor/dashboard/templates/dashboard/order/detail.html
+++ b/saleor/dashboard/templates/dashboard/order/detail.html
@@ -6,6 +6,8 @@
{% block title %}{{ order }} - {% trans "Orders" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-orders{% endblock %}
+
{% block page_title %}{% trans "Order" %} {{ order }}{% endblock %}
{% block content %}
diff --git a/saleor/dashboard/templates/dashboard/order/list.html b/saleor/dashboard/templates/dashboard/order/list.html
index 5133fa9e5b..bd7c099fd8 100644
--- a/saleor/dashboard/templates/dashboard/order/list.html
+++ b/saleor/dashboard/templates/dashboard/order/list.html
@@ -5,6 +5,8 @@
{% block title %}{% trans "Orders" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-orders{% endblock %}
+
{% block page_title %}{% trans "Orders" %}{% endblock %}
{% block content %}
diff --git a/saleor/dashboard/templates/dashboard/payments/detail.html b/saleor/dashboard/templates/dashboard/payments/detail.html
index 300bfce5e8..b36c92acea 100644
--- a/saleor/dashboard/templates/dashboard/payments/detail.html
+++ b/saleor/dashboard/templates/dashboard/payments/detail.html
@@ -7,6 +7,8 @@
{% block title %}{% trans "Payment" %} #{{ payment.id }} - {% trans "Payments" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-payments{% endblock %}
+
{% block page_title %}{% trans "Payment" %} #{{ payment.id }}{% endblock %}
{% block content %}
diff --git a/saleor/dashboard/templates/dashboard/payments/list.html b/saleor/dashboard/templates/dashboard/payments/list.html
index 12360d75d3..663dbbf978 100644
--- a/saleor/dashboard/templates/dashboard/payments/list.html
+++ b/saleor/dashboard/templates/dashboard/payments/list.html
@@ -5,6 +5,8 @@
{% block title %}{% trans "Payments" %} - {{ block.super }}{% endblock %}
+{% block body_class %}body-payments{% endblock %}
+
{% block page_title %}{% trans "Payments" %}{% endblock %}
{% block content %}
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index eef0773854..1fcc55cd66 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -72,6 +72,12 @@ $font-size-action-icon: 18px;
content: none;
}
+ @each $module in (home, orders, products, categories, customers, paymentss) {
+ .body-#{$module} &.nav-#{$module} {
+ @extend .active;
+ }
+ }
+
&.brand-logo {
top: 0;
width: 100%;