Skip to content

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

Improve templates

Michal Ociepkac326deb30ece
diff --git a/checkout/templates/checkout/address.html b/checkout/templates/checkout/address.html
index 96670a8fba..5e7b30a77e 100644
--- a/checkout/templates/checkout/address.html
+++ b/checkout/templates/checkout/address.html
@@ -7,19 +7,15 @@
{% block forms %}
<form method="post" class="form-horizontal">
{% csrf_token %}
-
- {% block extra_forms %}{% endblock %}
-
- {{ step.forms.management|as_bootstrap }}
- {% if user.is_authenticated %}
<fieldset>
+ {% if user.is_authenticated %}
<legend>Select address:</legend>
{{ step.forms.address_list|as_bootstrap }}
- </fieldset>
+ {% else %}
+ <legend>Enter address:</legend>
{% endif %}
- <fieldset>
- <legend>Complete address:</legend>
{{ step.forms.address|as_bootstrap }}
+ {% block extra_forms %}{% endblock %}
</fieldset>
<div class="form-actions">
diff --git a/checkout/templates/checkout/billing.html b/checkout/templates/checkout/billing.html
index e55459c20b..35b412a563 100644
--- a/checkout/templates/checkout/billing.html
+++ b/checkout/templates/checkout/billing.html
@@ -4,11 +4,6 @@
{% block extra_forms %}
{% if not user.is_authenticated %}
-<fieldset>
- <legend>
- User data:
- </legend>
- {{ step.forms.anonymous|as_bootstrap }}
-</fieldset>
+{{ step.forms.anonymous|as_bootstrap }}
{% endif %}
{% endblock extra_forms %}
diff --git a/order/templates/order/details.html b/order/templates/order/details.html
index e860256bf5..67dba40d17 100644
--- a/order/templates/order/details.html
+++ b/order/templates/order/details.html
@@ -4,7 +4,23 @@
{% load gross from prices %}
{% load i18n %}
- {% block title %}{{ block.super }} » {% trans "Order details" %}{% endblock %}
+{% block title %}{{ block.super }} » {% trans "Order details" %}{% endblock %}
+
+{% block outerbreadcrumb %}
+{% if order.user == user %}
+<ul class="breadcrumb" itemprop="breadcrumb">
+ <li>
+ <a href="/">{% trans "Home" %}</a> <span class="divider">/</span>
+ </li>
+ <li>
+ <a href="{% url 'profile:orders' %}">{% trans "Your orders" %}</a> <span class="divider">/</span>
+ </li>
+ <li>
+ <a href="{% url 'order:details' token=order.token %}">{{ order }}</a> <span class="divider">/</span>
+ </li>
+</ul>
+{% endif %}
+{% endblock outerbreadcrumb %}
{% block content %}
{# This view is available by just knowing url, #}
@@ -60,22 +76,13 @@
{% elif group.address %}
{{ group.address }}
<a class="address-details" href="#"
- data-content="{{ group.address.first_name }} {{ group.address.last_name }}
- <br>
- {{ group.address.company_name }}
- <br>
- {{ group.address.street_address_1 }}
- <br>
- {{ group.address.street_address_2 }}
- <br>
- {{ group.address.postal_code }} {{ group.address.city }}
- <br>
- {{ group.address.get_country_display }}
- <br>
- {{ group.address.country_area }}
- <br>
+ data-content="{% if group.address.company_name %}{{ group.address.company_name }}<br>{% endif %}
+ {{ group.address.street_address_1 }}<br>
+ {% if group.address.street_address_2 %}{{ group.address.street_address_2 }}<br>{% endif %}
+ {{ group.address.postal_code }} {{ group.address.city }}<br>
+ {{ group.address.country_area }}, {{ group.address.get_country_display }}<br>
{{ group.address.phone }}"
- data-html="true"><small>{% trans "details" %}</small></a>
+ data-html="true" title="{{ group.address.first_name }} {{ group.address.last_name }}"><small>{% trans "details" %}</small></a>
{% endif %}
</td>
{% endif %}
@@ -97,7 +104,7 @@
<li>{{ payment }} - {{ payment.status }}</li>
{% endfor %}
</ul>
-{% if not order.is_full_paid %}
+{% if not order.is_fully_paid %}
<a href="{% url 'order:payment:index' token=order.token %}">{% trans "Pay again" %}</a>
{% endif %}
{% endblock content %}
diff --git a/payment/templates/payment/details.html b/payment/templates/payment/details.html
index a443079dea..352cbf6711 100644
--- a/payment/templates/payment/details.html
+++ b/payment/templates/payment/details.html
@@ -4,6 +4,8 @@
{% block title %}{{ block.super }} » {% trans "Payment" %}{% endblock %}
+{% block outerbreadcrumb %}{% endblock %}
+
{% block content %}
<h2>Payment</h2>
{% block forms %}
diff --git a/registration/templates/registration/change_password.html b/registration/templates/registration/change_password.html
index f63ca770d2..30890aadff 100644
--- a/registration/templates/registration/change_password.html
+++ b/registration/templates/registration/change_password.html
@@ -15,11 +15,15 @@
{% endblock breadcrumb %}
{% block content %}
-<div>
- <form method="POST">
- {% csrf_token %}
+<form method="post" class="form-horizontal">
+ {% csrf_token %}
+ <fieldset>
+ <legend>{% trans 'Change password' %}</legend>
{{ form|as_bootstrap }}
- <input type="submit" value="{% trans "Update password" %}">
- </form>
-</div>
+ <input type="hidden" name="next" value="{{ next }}" />
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">{% trans 'Update password' %}</button>
+ </div>
+</form>
{% endblock %}
diff --git a/registration/templates/registration/invalid_token.html b/registration/templates/registration/invalid_token.html
index 04f76c4e9f..8416db0ea0 100644
--- a/registration/templates/registration/invalid_token.html
+++ b/registration/templates/registration/invalid_token.html
@@ -4,8 +4,6 @@
{% block title %}{{ block.super }} » {% trans "Invalid token" %}{% endblock %}
{% block content %}
- <div>
- Sorry, this link is invalid. Probably it has already been used or has expired.
- </div>
+ <p>Sorry, this link is invalid. Probably it has already been used or has expired.</p>
{% endblock %}
diff --git a/registration/templates/registration/login.html b/registration/templates/registration/login.html
index b40efb925b..66b678ecb9 100644
--- a/registration/templates/registration/login.html
+++ b/registration/templates/registration/login.html
@@ -5,34 +5,24 @@
{% block title %}{{ block.super }} » {% trans "Login" %}{% endblock %}
{% block content %}
-<form method="post" action="{% url 'registration:login' %}">
+<form method="post" action="{% url 'registration:login' %}" class="form-horizontal">
{% csrf_token %}
- {{ form|as_bootstrap }}
- <input type="submit" value="login" />
- <input type="hidden" name="next" value="{{ next }}" />
+ <fieldset>
+ <legend>{% trans 'Log in' %}</legend>
+ {{ form|as_bootstrap }}
+ <input type="hidden" name="next" value="{{ next }}" />
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">{% trans 'Log in' %}</button>
+ </div>
</form>
-
-<div>
- OR
-</div>
-
-<div>
- <a href="{{ facebook_login_url }}">Login via Facebook</a>
-</div>
-
-<div>
- OR
-</div>
-
-<div>
- <a href="{{ google_login_url }}">Login via Google</a>
-</div>
-
-<div>
- OR
-</div>
-
-<p>
- <a href="{% url 'registration:request_email_confirmation' %}">Create an account or reset password</a>
-</p>
+<ul>
+ <li>
+ <a href="{{ facebook_login_url }}">Login via Facebook</a>
+ </li>
+ <li>
+ <a href="{{ google_login_url }}">Login via Google</a>
+ </li>
+ <li><a href="{% url 'registration:request_email_confirmation' %}">Create an account or reset password</a></li>
+</ul>
{% endblock %}
diff --git a/registration/templates/registration/logout.html b/registration/templates/registration/logout.html
index 27450c0103..7812ab1862 100644
--- a/registration/templates/registration/logout.html
+++ b/registration/templates/registration/logout.html
@@ -4,5 +4,5 @@
{% block title %}{{ block.super }} » {% trans "Logged out" %}{% endblock %}
{% block content %}
-Successfully logged out!
+<p>Successfully logged out!</p>
{% endblock %}
diff --git a/registration/templates/registration/request_email_confirmation.html b/registration/templates/registration/request_email_confirmation.html
index 9f41c42957..32aa4f62d6 100644
--- a/registration/templates/registration/request_email_confirmation.html
+++ b/registration/templates/registration/request_email_confirmation.html
@@ -7,17 +7,20 @@
{% block breadcrumb %}
{{ block.super }}
<li>
- {# TODO: this serves for two view: email change and password reset/registration. Create new template to allow better breadcrumbs #}
- <a href=".">{% trans "Request email confirmation" %}</a> <span class="divider">/</span>
+ <a href="#">{% trans "Request email confirmation" %}</a> <span class="divider">/</span>
</li>
{% endblock breadcrumb %}
{% block content %}
-<div>
- <form method='post'>
- {% csrf_token %}
+<form method="post" class="form-horizontal">
+ {% csrf_token %}
+ <fieldset>
+ <legend>{% trans 'Request email confirmation' %}</legend>
{{ form|as_bootstrap }}
- <input type="submit" value="Continue">
- </form>
-</div>
+ <input type="hidden" name="next" value="{{ next }}" />
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">{% trans 'Continue' %}</button>
+ </div>
+</form>
{% endblock %}
diff --git a/registration/templates/registration/set_password.html b/registration/templates/registration/set_password.html
index 52003bcc38..0a7f503a03 100644
--- a/registration/templates/registration/set_password.html
+++ b/registration/templates/registration/set_password.html
@@ -5,15 +5,20 @@
{% block title %}{{ block.super }} » {% trans "Set password" %}{% endblock %}
{% block content %}
-<div>
- <form method="post">
- {% csrf_token %}
+<form method="post" class="form-horizontal">
+ {% csrf_token %}
+ <fieldset>
+ <legend>{% trans 'Set password' %}</legend>
{{ form|as_bootstrap }}
- <input type="submit" value="{% trans "Set password" %}">
- </form>
- <form method="post">
- {% csrf_token %}
- <input type="submit" value="{% trans "I don't want a password" %}">
- </form>
-</div>
+ </fieldset>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">{% trans 'Set password' %}</button>
+ </div>
+</form>
+<form method="post" class="form-horizontal">
+ {% csrf_token %}
+ <div class="form-actions">
+ <button type="submit" class="btn btn-danger">{% trans "I don't want a password" %}</button>
+ </div>
+</form>
{% endblock %}
diff --git a/saleor/templates/base.html b/saleor/templates/base.html
index 7708690e08..886ddf06a6 100644
--- a/saleor/templates/base.html
+++ b/saleor/templates/base.html
@@ -31,7 +31,7 @@
<body itemscope itemtype="http://schema.org/WebPage">
<header class="navbar navbar-inverse navbar-static-top">
<div class="navbar-inner">
- <div class="containe">
+ <div class="container">
<a class="brand" href="/">Saleor</a>
<nav class="nav-collapse collapse">
<ul class="nav">
@@ -39,13 +39,15 @@
<a href="/">Home</a>
</li>
<li class="dropdown">
- <a class="dropdown-toggle" data-toggle="dropdown" href="#"> {% trans "Categories" %} <b class="caret"></b> </a>
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#"> {% trans "Categories" %} <b class="caret"></b></a>
<ul class="dropdown-menu">
{% categories_list %}
</ul>
</li>
+ </ul>
+ <ul class="nav pull-right">
<li class="dropdown">
- <a data-toggle="dropdown" class="dropdown-toggle" href="{% url "cart:index" %}">{{ request.cart }}</a>
+ <a data-toggle="dropdown" class="dropdown-toggle" href="{% url "cart:index" %}">{{ request.cart }} <b class="caret"></b></a>
<ul class="dropdown-menu">
{% for cart_line in request.cart %}
<li><a href="{{ cart_line.product.get_absolute_url }}">{{ cart_line.product }} ({{ cart_line.quantity }})</a></li>
@@ -56,10 +58,10 @@
</li>
{% if user.is_authenticated %}
<li class="dropdown pull-right"> {# TODO pull-right not working #}
- <a data-toggle="dropdown" class="dropdown-toggle" href=".">{{ user }}</a>
+ <a data-toggle="dropdown" class="dropdown-toggle" href=".">{{ user }} <b class="caret"></b></a>
<ul class="dropdown-menu">
- <li><a href="{% url "profile:details" %}">{% trans "Profile edit" %}</a></li>
- <li><a href="{% url "profile:orders" %}">{% trans "Orders" %}</a></li>
+ <li><a href="{% url "profile:details" %}">{% trans "Your profile" %}</a></li>
+ <li><a href="{% url "profile:orders" %}">{% trans "Your orders" %}</a></li>
<li class="divider"></li>
<li><a href="{% url "registration:logout" %}">{% trans "Log out" %}</a></li>
</ul>
diff --git a/userprofile/forms.py b/userprofile/forms.py
index 3c65d4dda2..f013ccb724 100644
--- a/userprofile/forms.py
+++ b/userprofile/forms.py
@@ -5,6 +5,7 @@ from .models import Address, AddressBook
class AddressForm(forms.ModelForm):
+
class Meta:
model = Address
@@ -28,7 +29,9 @@ class AddressBookForm(forms.ModelForm):
class UserAddressesForm(forms.Form):
- address = forms.ModelChoiceField(queryset=AddressBook.objects.none())
+ address = forms.ModelChoiceField(queryset=AddressBook.objects.none(),
+ required=False,
+ empty_label='Enter below')
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', AnonymousUser()) or AnonymousUser()
diff --git a/userprofile/templates/userprofile/orders.html b/userprofile/templates/userprofile/orders.html
index f17e32ad9d..f12b47700b 100644
--- a/userprofile/templates/userprofile/orders.html
+++ b/userprofile/templates/userprofile/orders.html
@@ -4,9 +4,6 @@
{% block breadcrumb %}
{{ block.super }}
-<li>
- <a href="{% url 'profile:details' %}">{% trans "Your profile" %}</a> <span class="divider">/</span>
-</li>
<li>
<a href="{% url 'profile:orders' %}">{% trans "Your orders" %}</a> <span class="divider">/</span>
</li>
diff --git a/userprofile/urls.py b/userprofile/urls.py
index 36905fe891..d3f2e81e73 100644
--- a/userprofile/urls.py
+++ b/userprofile/urls.py
@@ -17,5 +17,4 @@ urlpatterns = patterns(
url(r'^address/(?P<pk>\d+)/make-default-for-'
'(?P<purpose>billing|shipping)/$',
'userprofile.views.address_make_default',
- name='address-make-default'),
-)
+ name='address-make-default'))