Adding breadcrumbs
This commit is contained in:
parent
55fccf54fe
commit
8737c2f8ad
|
@ -105,3 +105,7 @@ footer {
|
|||
bottom: 0px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.breadcrumb > li.pull-right::before {
|
||||
content: "";
|
||||
}
|
||||
|
|
|
@ -3,18 +3,43 @@
|
|||
|
||||
{% block shop_content %}
|
||||
|
||||
<h2>{{ product.name }}</h2>
|
||||
<div class="col-md-8">
|
||||
|
||||
<div class="row">
|
||||
<h2>{{ product.name }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<p>
|
||||
{{ product.description }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<h3>Add to order</h3>
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
|
||||
{% if product.is_available %}
|
||||
|
||||
<form method="POST">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% bootstrap_button "Add to order" button_type="submit" button_class="btn-primary" %}
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
|
||||
<p>
|
||||
This product is available from
|
||||
{{ product.available_in.lower|date:"Y-m-d H:i" }}
|
||||
</p>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
<a href="{% url 'account_signup' %}?next={% url 'shop:product_detail' slug=product.slug %}">
|
||||
Signup</a> or
|
||||
|
@ -23,3 +48,7 @@
|
|||
to order this product
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -4,15 +4,23 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
{% if user.is_authenticated and user.orders.exists %}
|
||||
<a href="{% url 'shop:order_list' %}" class="btn btn-grey">Previous orders</a>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{% url 'shop:index' %}">Shop</a></li>
|
||||
{% if product %}
|
||||
<li><a href="{% url 'shop:index' %}?category={{product.category.slug}}">{{ product.category }}</a></li>
|
||||
<li class="active">{{ product.name }}</li>
|
||||
{% elif current_category %}
|
||||
<li class="active">{{ current_category }}</li>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if user.is_authenticated and user.orders.exists %}
|
||||
<li class="pull-right"><a href="{% url 'shop:order_list' %}">Previous orders</a></li>
|
||||
{% endif %}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block shop_content %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
{% load shop_tags %}
|
||||
|
||||
{% block shop_content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p>
|
||||
Categories:<br />
|
||||
{% for category in categories %}
|
||||
<a href="{% url 'shop:index' %}?category={{category.slug}}"
|
||||
class="label label-{% if category.slug == current_category %}primary{% else %}default{% endif %}">
|
||||
class="label label-{% if category.slug == current_category.slug %}primary{% else %}default{% endif %}">
|
||||
{{category}}
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
|
|
@ -110,7 +110,7 @@ class ShopIndexView(ListView):
|
|||
context['products'] = context['products'].filter(
|
||||
category__slug=category
|
||||
)
|
||||
context['current_category'] = category
|
||||
context['current_category'] = categoryobj
|
||||
context['categories'] = ProductCategory.objects.annotate(
|
||||
num_products=Count('products')
|
||||
).filter(
|
||||
|
|
Loading…
Reference in a new issue