From 8737c2f8adbfc57a9bf46b91a692e7177e5830ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Mon, 30 May 2016 20:56:03 +0200 Subject: [PATCH] Adding breadcrumbs --- bornhack/static_src/css/bornhack.css | 4 +++ shop/templates/product_detail.html | 49 ++++++++++++++++++++++------ shop/templates/shop_base.html | 16 ++++++--- shop/templates/shop_index.html | 3 +- shop/views.py | 2 +- 5 files changed, 58 insertions(+), 16 deletions(-) diff --git a/bornhack/static_src/css/bornhack.css b/bornhack/static_src/css/bornhack.css index 2943fcfc..09078f53 100644 --- a/bornhack/static_src/css/bornhack.css +++ b/bornhack/static_src/css/bornhack.css @@ -105,3 +105,7 @@ footer { bottom: 0px; padding: 5px; } + +.breadcrumb > li.pull-right::before { + content: ""; +} diff --git a/shop/templates/product_detail.html b/shop/templates/product_detail.html index 0d47aa14..7e546ab9 100644 --- a/shop/templates/product_detail.html +++ b/shop/templates/product_detail.html @@ -3,23 +3,52 @@ {% block shop_content %} -

{{ product.name }}

+
-

+

+

{{ product.name }}

+
+ +
+

{{ product.description }} -

+

+
-{% if user.is_authenticated %} -
+
+ +
+ +

Add to order

+ + {% if user.is_authenticated %} + + {% if product.is_available %} + + {% csrf_token %} {% bootstrap_form form %} {% bootstrap_button "Add to order" button_type="submit" button_class="btn-primary" %} - -{% else %} + + + {% else %} + +

+ This product is available from + {{ product.available_in.lower|date:"Y-m-d H:i" }} +

+ + {% endif %} + + {% else %} Signup or login -to order this product -{% endif %} -{% endblock %} + to order this product + {% endif %} + {% endblock %} + +
+ + diff --git a/shop/templates/shop_base.html b/shop/templates/shop_base.html index 9147b008..1c846149 100644 --- a/shop/templates/shop_base.html +++ b/shop/templates/shop_base.html @@ -4,15 +4,23 @@
-
- {% if user.is_authenticated and user.orders.exists %} - Previous orders +
+ {% if user.is_authenticated and user.orders.exists %} +
  • Previous orders
  • + {% endif %} +
    {% block shop_content %} + {% endblock %} {% endblock %} diff --git a/shop/templates/shop_index.html b/shop/templates/shop_index.html index bc8676f2..e84cdf5b 100644 --- a/shop/templates/shop_index.html +++ b/shop/templates/shop_index.html @@ -3,13 +3,14 @@ {% load shop_tags %} {% block shop_content %} +

    Categories:
    {% for category in categories %} + class="label label-{% if category.slug == current_category.slug %}primary{% else %}default{% endif %}"> {{category}}   {% endfor %} diff --git a/shop/views.py b/shop/views.py index e7c85b33..2f0c9125 100644 --- a/shop/views.py +++ b/shop/views.py @@ -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(