Skip to content

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

Much more pleasant templates

Patryk Zawadzki6a75d170761e
diff --git a/cart/__init__.py b/cart/__init__.py
index c1e17d9126..f90fafaa4c 100755
--- a/cart/__init__.py
+++ b/cart/__init__.py
@@ -30,13 +30,16 @@ class BaseGroup(list, ItemSet):
def get_delivery_total(self, **kwargs):
'''
Method returns price from the self.delivery_method or lowest price
- form delivery methods.
+ from delivery methods.
'''
if self.delivery_method:
return self.delivery_method.get_price_per_item(**kwargs)
methods = self.get_delivery_methods()
return min(method.get_price_per_item(**kwargs) for method in methods)
+ def get_total_with_delivery(self, **kwargs):
+ return self.get_total() + self.get_delivery_total()
+
class ShippedGroup(BaseGroup):
'''
diff --git a/cart/templates/cart/index.html b/cart/templates/cart/index.html
index ff75627c41..f878bcf9af 100644
--- a/cart/templates/cart/index.html
+++ b/cart/templates/cart/index.html
@@ -15,37 +15,47 @@
<form role="form" action="." method="post">
{% csrf_token %}
{{ formset.management_form }}
- <table class="table table-bordered">
+ <table class="table table-striped">
<thead>
<tr>
- <th>#</th><th>{% trans "Name" %}</th><th colspan="2">{% trans "Quantity" %}</th><th>{% trans "Price" %}</th>
+ <th class="col-lg-4">{% trans "Product" %}</th>
+ <th class="col-lg-2">{% trans "Quantity" %}</th>
+ <th class="col-lg-2">{% trans "Price" %}</th>
+ <th class="col-lg-2">{% trans "Subtotal" %}</th>
</tr>
</thead>
+ <tfoot>
+ <tr>
+ <td class="col-lg-4">{% trans "Shipping" %}</td>
+ <td class="col-lg-2"></td>
+ <td class="col-lg-2"></td>
+ <td class="col-lg-2">{% gross cart.get_delivery_total %}</td>
+ </tr>
+ <tr>
+ <td class="col-lg-4"></td>
+ <td class="col-lg-2">
+ <button class="btn btn-default" type="submit">
+ {% trans "Update quantities" %}
+ </button>
+ </td>
+ <th class="col-lg-2">{% trans "Total" %}:</th>
+ <td class="col-lg-2">{% gross cart.get_total %}</td>
+ </tr>
+ </tfoot>
<tbody>
{% for form in formset %}
<tr>
- <td>{{ forloop.counter }}</td>
<td>{{ form.cart_line.product }}</td>
- <td colspan="2">{{ form.quantity|as_vertical_form:False }}</td>
+ <td>{{ form.quantity|as_vertical_form:False }}</td>
<td>{% gross form.cart_line.get_price_per_item %}</td>
+ <td>{% gross form.cart_line.get_total %}</td>
</tr>
{% endfor %}
</tbody>
- <tfoot>
- <tr>
- <td colspan="2">{% trans "Shipping" %}: {% gross cart.get_delivery_total %}</td>
- <td>
- <button class="btn" type="submit">
- {% trans "Update" %}
- </button></td>
- <td>{% trans "Total" %}:</td>
- <td>{% gross cart.get_total %}</td>
- </tr>
- </tfoot>
</table>
<div class="form-group">
<div>
- <a href="{% url "checkout:index" %}" class="btn btn-default btn-primary">Checkout</a>
+ <a href="{% url "checkout:index" %}" class="btn btn-primary">Checkout</a>
</div>
</div>
</form>
diff --git a/checkout/templates/checkout/address.html b/checkout/templates/checkout/address.html
index 1ad0d466f9..861ee4d1f6 100644
--- a/checkout/templates/checkout/address.html
+++ b/checkout/templates/checkout/address.html
@@ -18,14 +18,10 @@
{% block extra_forms %}{% endblock %}
</fieldset>
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">
- Save changes
- </button>
- <button type="button" class="btn">
- Cancel
- </button>
- </div>
+ <button type="submit" class="btn btn-primary">
+ {% trans "Save changes" %}
+ </button>
+ <a href="{% url "cart:index" %}" class="btn btn-link">{% trans "Cancel" %}</a>
</form>
{% endblock forms %}
diff --git a/checkout/templates/checkout/digitaldelivery.html b/checkout/templates/checkout/digitaldelivery.html
index 28eb1157b8..05dc03d596 100644
--- a/checkout/templates/checkout/digitaldelivery.html
+++ b/checkout/templates/checkout/digitaldelivery.html
@@ -8,13 +8,13 @@
<form method="post" class="form-horizontal">
{% csrf_token %}
{{ step.forms.email|as_horizontal_form }}
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">
- Save changes
- </button>
- <button type="button" class="btn">
- Cancel
- </button>
+ <div class="form-group">
+ <div class="col-lg-offset-2 col-lg-10">
+ <button type="submit" class="btn btn-primary">
+ {% trans "Save changes" %}
+ </button>
+ <a href="{% url "cart:index" %}" class="btn btn-link">{% trans "Cancel" %}</a>
+ </div>
</div>
</form>
{% endblock forms %}
diff --git a/checkout/templates/checkout/summary.html b/checkout/templates/checkout/summary.html
index 9724c33bda..ea8410f5a4 100644
--- a/checkout/templates/checkout/summary.html
+++ b/checkout/templates/checkout/summary.html
@@ -5,9 +5,10 @@
{% block title %}{{ block.super }} » {% trans "Summary" %}{% endblock %}
{% block forms %}
-<h2>Billing address</h2>
+<h2>{% trans "Billing address" %}</h2>
+
{% with address=checkout.billing_address %}
-<p>
+<address>
{{ address.first_name }} {{ address.last_name }}
<br />
{{ address.street_address_1 }}{% if address.street_address_2 %}{{ address.street_address_2 }}{% endif %}
@@ -17,41 +18,50 @@
{{ address.country_area }} {{ address.country }}
<br />
{{ address.phone }}
-</p>
+</address>
{% endwith %}
-<table class="table table-bordered">
+
+<table class="table table-striped">
<thead>
<tr>
- <th>Name</th><th>Price per item</th><th>Quantity</th><th>Total</th><th>Delivery price</th>
+ <th class="col-lg-4">{% trans "Product" %}</th>
+ <th class="col-lg-2">{% trans "Price" %}</th>
+ <th class="col-lg-2">{% trans "Subtotal" %}</th>
+ <th class="col-lg-2">{% trans "Shipping" %}</th>
+ <th class="col-lg-2">{% trans "Total" %}</th>
</tr>
</thead>
+ <tfoot>
+ <tr>
+ <td colspan="3" class="col-lg-8"></td>
+ <th class="col-lg-2">{% trans "Total" %}:</th>
+ <td class="col-lg-2">{% gross checkout.groups.get_total %}</td>
+ </tr>
+ </tfoot>
<tbody>
{% for group in checkout.groups %}
{% for item in group %}
<tr>
- <td>{{ item.product }}</td>
- <td>{% gross item.get_price_per_item %}</td>
- <td>{{ item.quantity }}</td>
- <td>{% gross item.get_total %}</td>
+ <td class="col-lg-4"><em>{{ item.quantity }}×</em> {{ item.product }}</td>
+ <td class="col-lg-2">{% gross item.get_price_per_item %}</td>
+ <td class="col-lg-2">{% gross item.get_total %}</td>
{% if forloop.first %}
- <td rowspan="{{ group|length }}">{% gross group.get_delivery_total %}</td>
+ <td rowspan="{{ group|length }}" class="col-lg-2">
+ {% gross group.get_delivery_total %}
+ <p>{{ group.address }}</p>
+ </td>
+ <td rowspan="{{ group|length }}" class="col-lg-2">{% gross group.get_total_with_delivery %}</td>
{% endif %}
</tr>
{% endfor %}
{% endfor %}
</tbody>
- <tfoot>
- <tr>
- <td>Total</td><td colspan="4">{% gross checkout.groups.get_total %}</td>
- </tr>
- </tfoot>
</table>
-<form method="post" class="form-horizontal">
+<form method="post">
{% csrf_token %}
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">
- Save changes
- </button>
- </div>
+ <button type="submit" class="btn btn-primary">
+ {% trans "Save changes" %}
+ </button>
+ <a href="{% url "cart:index" %}" class="btn btn-link">{% trans "Cancel" %}</a>
</form>
{% endblock forms %}
diff --git a/order/templates/order/details.html b/order/templates/order/details.html
index 830440574d..0138855f95 100644
--- a/order/templates/order/details.html
+++ b/order/templates/order/details.html
@@ -22,7 +22,7 @@
{% if order.user == user %}
<h2>{% trans "Billing address" %}</h2>
{% with address=order.billing_address %}
- <p>
+ <address>
{{ address.first_name }} {{ address.last_name }}
<br />
{{ address.street_address_1 }}{% if address.street_address_2 %}{{ address.street_address_2 }}{% endif %}
@@ -32,73 +32,76 @@
{{ address.country_area }} {{ address.country }}
<br />
{{ address.phone }}
- </p>
+ </address>
{% endwith %}
{% endif %}
<h2>{% trans "Order details" %}</h2>
-<p>{% trans "Status" %}: {{ order.get_status_display }}</p>
-<table class="table table-bordered">
+<p>{% trans "Status" %}: <span class="label label-default">{{ order.get_status_display }}</span></p>
+<table class="table table-striped">
<thead>
<tr>
- <th>{% trans "Name" %}</th>
- <th>{% trans "Price per item" %}</th>
- <th>{% trans "Quantity" %}</th>
- <th>{% trans "Total" %}</th>
- <th>{% trans "Delivery price" %}</th>
- <th>{% trans "Status" %}</th>
- {% if order.user == user %}
- <th>{% trans "Delivery address" %}</th>
- {% endif %}
+ <th class="col-lg-4">{% trans "Name" %}</th>
+ <th class="col-lg-2">{% trans "Price" %}</th>
+ <th class="col-lg-2">{% trans "Subotal" %}</th>
+ <th class="col-lg-2">{% trans "Shipping" %}</th>
+ <th class="col-lg-2">{% trans "Total" %}</th>
</tr>
</thead>
+ <tfoot>
+ <tr>
+ <td colspan="3" class="col-lg-8"></td>
+ <th class="col-lg-2">{% trans "Total" %}</th>
+ <td class="col-lg-2">{% gross order.get_total %}</td>
+ </tr>
+ </tfoot>
<tbody>
{% for group in groups %}
{% for item in group %}
<tr>
- <td>{{ item.product }}</td>
- <td>{% gross item.get_price_per_item %}</td>
- <td>{{ item.quantity }}</td>
- <td>{% gross item.get_price_per_item %}</td>
+ <td class="col-lg-4"><em>{{ item.quantity }}×</em> {{ item.product }}</td>
+ <td class="col-lg-2">{% gross item.get_price_per_item %}</td>
+ <td class="col-lg-2">{% gross item.get_total %}</td>
{% if forloop.first %}
- <td rowspan="{{ group.items.count }}">{% gross group.price %}</td>
- <td rowspan="{{ group.items.count }}">{{ group.get_status_display }}</td>
- {% if order.user == user %}
- <td rowspan="{{ group.items.count }}">
- {% if group.email %}
- {{ group.email }}
- {% elif group.address %}
- {{ group.address }}
- <a class="address-details" href="#"
- 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" title="{{ group.address.first_name }} {{ group.address.last_name }}"><small>{% trans "details" %}</small></a>
+ <td rowspan="{{ group.items.count }}" class="col-lg-2">
+ {% gross group.price %}
+ {% if order.user == user %}
+ {% if group.email %}
+ {{ group.email }}
+ {% elif group.address %}
+ <p>
+ {{ group.address }}
+ <a class="address-details" href="#"
+ 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" title="{{ group.address.first_name }} {{ group.address.last_name }}"><small>{% trans "details" %}</small></a>
+ </p>
+ {% endif %}
+ <p>{% trans "Status" %}: <span class="label label-default">{{ group.get_status_display }}</span></p>
{% endif %}
</td>
- {% endif %}
+ <td rowspan="{{ group.items.count }}" class="col-lg-2">
+ {% gross group.get_total %}
+ </td>
{% endif %}
</tr>
{% endfor %}
{% endfor %}
</tbody>
- <tfoot>
- <tr>
- <td>{% trans "Total" %}</td>
- <td colspan="{% if user == order.user %}6{% else %}5{% endif %}">{% gross order.get_total %}</td>
- </tr>
- </tfoot>
</table>
-<h2>{% trans "Payments" %}</h2>
+{% if order.user == user %}
+<h2>{% trans "Payment history" %}</h2>
<ul>
{% for payment in payments %}
- <li>{{ payment }} - {{ payment.status }}</li>
+ <li>{{ payment.created|date }} — <span class="label label-default">{{ payment.get_status_display }}</span></li>
{% endfor %}
</ul>
{% if not order.is_fully_paid %}
- <a href="{% url 'order:payment:index' token=order.token %}">{% trans "Pay again" %}</a>
+ <a href="{% url 'order:payment:index' token=order.token %}" class="btn btn-primary">{% trans "Make a payment" %}</a>
+{% endif %}
{% endif %}
{% endblock content %}
diff --git a/order/templates/order/success.html b/order/templates/order/success.html
index 33cefd3ec1..33244c7f0f 100644
--- a/order/templates/order/success.html
+++ b/order/templates/order/success.html
@@ -7,13 +7,11 @@
{% block content %}
<h2>Your order has been received</h2>
-<p>
- <strong>Thank you for your purchase!</strong>
- <br />
- Your order # is: <a href="{% url 'order:details' token=order.token %}">{{ order.id }}</a>.
-</p>
+<p>{% trans "Thank you for your purchase!" %}</p>
+<p>{% trans "Your order number is" %}: <a href="{% url 'order:details' token=order.token %}">{{ order }}</a></p>
{% endblock content %}
+
{% block google-analytics-script %}
{{ block.super }}
__ga('require', 'ecommerce', 'ecommerce.js');
diff --git a/payment/templates/payment/default.html b/payment/templates/payment/default.html
index 5babad92a9..67a4917f28 100644
--- a/payment/templates/payment/default.html
+++ b/payment/templates/payment/default.html
@@ -8,10 +8,12 @@
<form method="{{ form.method }}" class="form-horizontal"{% if form.action %} action="{{ form.action }}"{% endif %}>
{% csrf_token %}
{{ form|as_horizontal_form }}
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">
- Save changes
- </button>
+ <div class="form-group">
+ <div class="col-lg-offset-2 col-lg-10">
+ <button type="submit" class="btn btn-primary">
+ {% trans "Save changes" %}
+ </button>
+ </div>
</div>
</form>
{% endblock forms %}
diff --git a/payment/templates/payment/details.html b/payment/templates/payment/details.html
index 5bf75ffaf3..0392ea05e9 100644
--- a/payment/templates/payment/details.html
+++ b/payment/templates/payment/details.html
@@ -11,11 +11,14 @@
{% block forms %}
{% if form %}
<form method="post" action="{{ form.action }}" class="form-horizontal">
+ {% csrf_token %}
{{ form|as_horizontal_form }}
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">
- Save changes
- </button>
+ <div class="form-group">
+ <div class="col-lg-offset-2 col-lg-10">
+ <button type="submit" class="btn btn-primary">
+ {% trans "Save changes" %}
+ </button>
+ </div>
</div>
</form>
{% endif %}
diff --git a/payment/templates/payment/index.html b/payment/templates/payment/index.html
index 83e673dd98..b7b0f3184b 100644
--- a/payment/templates/payment/index.html
+++ b/payment/templates/payment/index.html
@@ -7,19 +7,24 @@
{% block forms %}
{% if waiting_payment %}
-<form class="form-inline" method="post" action="{% url 'order:payment:delete' token=order.token %}">
+<form method="post" action="{% url 'order:payment:delete' token=order.token %}">
{% csrf_token %}
- {{ waiting_payment }} - {{ waiting_payment.status }} {{ waiting_payment_form }}
- <button type="submit" class="btn">Delete</button>
+ <p>{% trans "You have already started the payment process for this order." %}</p>
+ <p>{% trans "Status" %}: <span class="label label-default">{{ waiting_payment.get_status_display }}</span></p>
+ {{ waiting_payment_form|as_horizontal_form }}
+ <button type="submit" class="btn btn-danger">{% trans "Delete this payment" %}</button>
</form>
{% else %}
<form method="post" class="form-horizontal">
{% csrf_token %}
{{ form|as_horizontal_form }}
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">
- Save changes
- </button>
+ <div class="form-group">
+ <div class="col-lg-offset-2 col-lg-10">
+ <button type="submit" class="btn btn-primary">
+ {% trans "Save changes" %}
+ </button>
+ <a href="{% url "cart:index" %}" class="btn btn-link">{% trans "Cancel" %}</a>
+ </div>
</div>
</form>
{% endif %}
diff --git a/payment/templates/payment/paypal-card.html b/payment/templates/payment/paypal-card.html
index ba470ff167..d153168e2e 100644
--- a/payment/templates/payment/paypal-card.html
+++ b/payment/templates/payment/paypal-card.html
@@ -25,10 +25,12 @@
</div>
</div>
{{ form.cvv2|as_horizontal_form }}
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">
- Save changes
- </button>
+ <div class="form-group">
+ <div class="col-lg-offset-2 col-lg-10">
+ <button type="submit" class="btn btn-primary">
+ {% trans "Save changes" %}
+ </button>
+ </div>
</div>
</form>
{% endblock forms %}
diff --git a/saleor/templates/bootstrap/_field_horizontal.html b/saleor/templates/bootstrap/_field_horizontal.html
index ff3c0e3dba..44a29f7d7c 100644
--- a/saleor/templates/bootstrap/_field_horizontal.html
+++ b/saleor/templates/bootstrap/_field_horizontal.html
@@ -54,9 +54,13 @@
{{ bound_field }}
{% endif %}
+ {% if bound_field.help_text %}
+ <span class="help-block">{{ bound_field.help_text }}</span>
+ {% endif %}
+
{% if bound_field.errors %}
{% for error in bound_field.errors %}
- <span class="help-inline error">{{ error }}</span>
+ <span class="label label-danger">{{ error }}</span>
{% endfor %}
{% endif %}
</div>
diff --git a/saleor/templates/bootstrap/_field_vertical.html b/saleor/templates/bootstrap/_field_vertical.html
index d84ce49833..0240042423 100644
--- a/saleor/templates/bootstrap/_field_vertical.html
+++ b/saleor/templates/bootstrap/_field_vertical.html
@@ -54,9 +54,13 @@
{{ bound_field }}
{% endif %}
+ {% if bound_field.help_text %}
+ <span class="help-block">{{ bound_field.help_text }}</span>
+ {% endif %}
+
{% if bound_field.errors %}
{% for error in bound_field.errors %}
- <span class="help-inline error">{{ error }}</span>
+ <span class="label label-danger">{{ error }}</span>
{% endfor %}
{% endif %}
</div>
diff --git a/userprofile/templates/userprofile/address-delete.html b/userprofile/templates/userprofile/address-delete.html
index 3d1d251e6d..b2410690ea 100644
--- a/userprofile/templates/userprofile/address-delete.html
+++ b/userprofile/templates/userprofile/address-delete.html
@@ -4,12 +4,11 @@
{% block title %}{{ block.super }} » {% trans "Delete Address" %}{% endblock %}
{% block content %}
- <div>
- Are you sure?
- <form action="." method="post">
- {% csrf_token %}
- <button type="submit" class="btn">Delete</button>
- <a href="{% url 'profile:details' %}" class="btn">Cancel</a>
- </form>
- </div>
+ <h2>{% trans "Are you sure you want to delete the following address?" %}</h2>
+ <p>{{ object.address }}</p>
+ <form action="." method="post">
+ {% csrf_token %}
+ <button type="submit" class="btn btn-danger">{% trans "Delete" %}</button>
+ <a href="{% url 'profile:details' %}" class="btn btn-link">{% trans "Cancel" %}</a>
+ </form>
{% endblock content %}
diff --git a/userprofile/templates/userprofile/address-edit.html b/userprofile/templates/userprofile/address-edit.html
index 193f5a330a..d6e4d6cea6 100644
--- a/userprofile/templates/userprofile/address-edit.html
+++ b/userprofile/templates/userprofile/address-edit.html
@@ -1,4 +1,6 @@
{% extends "base.html" %}
+
+{% load as_horizontal_form from bootstrap %}
{% load i18n %}
{% block title %}{{ block.super }} » {% trans "Edit Address" %}{% endblock %}
@@ -6,26 +8,26 @@
{% block breadcrumb %}
{{ block.super }}
<li><a href="{% url 'profile:details' %}">{% trans "Your profile" %}</a></li>
+{% if address_form.instance.pk %}
<li><a href=".">{% trans "Edit address" %}</a></li>
+{% else %}
+ <li><a href=".">{% trans "New address" %}</a></li>
+{% endif %}
{% endblock breadcrumb %}
{% block content %}
- <form action="." method="post">
+ <form class="form-horizontal" action="." method="post">
{% csrf_token %}
- {% if address_form.errors or address_book_form.errors %}
- <div class="alert alert-error">
- Please correct errors below.
- </div>
- {% endif %}
<fieldset>
<legend>Address</legend>
- {% with form=address_book_form %}
- {% include 'saleor/partials/form.html' %}
- {% endwith %}
- {% with form=address_form %}
- {% include 'saleor/partials/form.html' %}
- {% endwith %}
+ {{ address_book_form|as_horizontal_form }}
+ {{ address_form|as_horizontal_form }}
</fieldset>
- <button type="submit" class="btn">Save</button>
+ <div class="form-group">
+ <div class="col-lg-10 col-lg-offset-2">
+ <button type="submit" class="btn btn-default">Save</button>
+ <a href="{% url 'profile:details' %}" class="btn btn-link">Cancel</a>
+ </div>
+ </div>
</form>
{% endblock content %}
diff --git a/userprofile/templates/userprofile/details.html b/userprofile/templates/userprofile/details.html
index ed6669a426..c8c83d6fb4 100644
--- a/userprofile/templates/userprofile/details.html
+++ b/userprofile/templates/userprofile/details.html
@@ -9,51 +9,64 @@
{% endblock breadcrumb %}
{% block content %}
- <ul>
- {% for entry in address_book %}
- <li>
- <p>
- {{ entry }}
- {% if user.default_shipping_address == entry and user.default_billing_address == entry %}
- {% trans "(default for billing and shipping)" %}
- {% elif user.default_shipping_address == entry %}
- {% trans "(default for shipping)" %}
- {% elif user.default_billing_address == entry %}
- {% trans "(default for billing)" %}
- {% endif %}
- </p>
- <div class="row">
- <div class="span">
- <a href="{% url 'profile:address-edit' pk=entry.pk slug=entry.get_slug %}" class="btn">{% trans "Edit" %}</a>
- </div>
- <div class="span">
- <form method="post" action="{% url "profile:address-make-default" pk=entry.pk purpose="shipping" %}" class="form-inline form-horizontal">
+ <h2>{% trans "Profile" %}</h2>
+ <p>
+ <a href="{% url 'registration:change_password' %}" class="btn btn-default">{% trans 'Change your password' %}</a>
+ <a href="{% url 'registration:request_email_change' %}" class="btn btn-default">{% trans 'Change your email address' %}</a>
+ </p>
+
+
+ <h2>{% trans "Address book" %}</h2>
+ <table class="table table-striped">
+ <thead>
+ <tr>
+ <th class="col-lg-2">{% trans "Short alias" %}</th>
+ <th class="col-lg-4">{% trans "Addressee" %}</th>
+ <th class="col-lg-2">{% trans "Billing" %}</th>
+ <th class="col-lg-2">{% trans "Shipping" %}</th>
+ <th class="col-lg-2"></th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for entry in address_book %}
+ <tr>
+ <th class="col-lg-2">
+ {{ entry }}
+ </th>
+ <td class="col-lg-4">
+ {{ entry.address }}
+ </td>
+ <td class="col-lg-2">
+ {% if user.default_billing_address == entry %}
+ <span class="label label-default">{% trans "Default" %}</span>
+ {% else %}
+ <form method="post" action="{% url "profile:address-make-default" pk=entry.pk purpose="billing" %}" class="form-inline form-horizontal">
{% csrf_token %}
- <input type="submit" value="{% trans "Make default for shipping" %}" class="btn">
+ <button type="submit" class="btn btn-default">{% trans "Make default" %}</button>
</form>
- </div>
- <div class="span">
- <form method="post" action="{% url "profile:address-make-default" pk=entry.pk purpose="billing" %}" class="form-inline form-horizontal">
+ {% endif %}
+ </td>
+ <td class="col-lg-2">
+ {% if user.default_shipping_address == entry %}
+ <span class="label label-default">{% trans "Default" %}</span>
+ {% else %}
+ <form method="post" action="{% url "profile:address-make-default" pk=entry.pk purpose="shipping" %}" class="form-inline form-horizontal">
{% csrf_token %}
- <input type="submit" value="{% trans "Make default for billing" %}" class="btn">
+ <button type="submit" class="btn btn-default">{% trans "Make default" %}</button>
</form>
- </div>
- <div class="span">
- <a href="{% url 'profile:address-delete' pk=entry.pk slug=entry.get_slug %}" class="btn">{% trans "Delete" %}</a>
- </div>
- </div>
- </li>
- {% endfor %}
- </ul>
+ {% endif %}
+ </td>
+ <td class="col-lg-2">
+ <a href="{% url 'profile:address-edit' pk=entry.pk slug=entry.get_slug %}" class="btn btn-default"><i class="glyphicon glyphicon-edit"></i> {% trans "Edit" %}</a>
+ <a href="{% url 'profile:address-delete' pk=entry.pk slug=entry.get_slug %}" class="btn btn-danger"><i class="glyphicon glyphicon-remove"></i> {% trans "Delete" %}</a>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
<div>
- <a href="{% url 'profile:address-create' %}" class="btn">{% trans "Add new address" %}</a>
- </div>
- <div>
- <a href="{% url 'registration:request_email_change' %}">{% trans 'Change your email address' %}</a>
- </div>
- <div>
- <a href="{% url 'registration:change_password' %}">{% trans 'Change password' %}</a>
+ <a href="{% url 'profile:address-create' %}" class="btn btn-default"><i class="glyphicon glyphicon-plus-sign"></i> {% trans "Add new address" %}</a>
</div>
diff --git a/userprofile/templates/userprofile/orders.html b/userprofile/templates/userprofile/orders.html
index 4a03179e62..79845c223c 100644
--- a/userprofile/templates/userprofile/orders.html
+++ b/userprofile/templates/userprofile/orders.html
@@ -8,49 +8,43 @@
{% endblock breadcrumb %}
{% block content %}
- <table class="table">
+ <table class="table table-striped">
<thead>
<tr>
- <th>
- {% trans "Order" %}
+ <th class="col-lg-2">
+ {% trans "Order #" %}
</th>
- <th>
- {% trans "Price" %}
- </th>
- <th>
+ <th class="col-lg-2">
{% trans "Date" %}
</th>
- <th>
- {% trans "Last status change" %}
+ <th class="col-lg-2">
+ {% trans "Price" %}
</th>
- <th>
+ <th class="col-lg-2">
{% trans "Status" %}
</th>
- <th>
- <!-- details link -->
+ <th class="col-lg-2">
+ {% trans "Last status change" %}
</th>
</tr>
</thead>
<tbody>
{% for order in orders %}
<tr>
- <td>
- {{ order }}
+ <td class="col-lg-2">
+ <a href="{{ order.get_absolute_url }}">{{ order }}</a>
</td>
- <td>
- {% gross order.get_total %}
- </td>
- <td>
+ <td class="col-lg-2">
{{ order.created }}
</td>
- <td>
- {{ order.last_status_change }}
+ <td class="col-lg-2">
+ {% gross order.get_total %}
</td>
- <td>
- {{ order.get_status_display }}
+ <td class="col-lg-2">
+ <span class="label label-default">{{ order.get_status_display }}</span>
</td>
- <td>
- <a href="{{ order.get_absolute_url }}">{% trans "See details" %}</a>
+ <td class="col-lg-2">
+ {{ order.last_status_change }}
</td>
</tr>
{% endfor %}
diff --git a/userprofile/views.py b/userprofile/views.py
index 64977cbf52..a7d5f9e29f 100755
--- a/userprofile/views.py
+++ b/userprofile/views.py
@@ -93,7 +93,8 @@ def address_delete(request, slug, pk):
messages.success(request, message % address_book)
return HttpResponseRedirect(reverse("profile:details"))
- return TemplateResponse(request, "userprofile/address-delete.html")
+ return TemplateResponse(request, "userprofile/address-delete.html",
+ context={'object': address_book})
@login_required