]> git.parisson.com Git - diggersdigest.git/commitdiff
Add showcase support and reduce margin for product grid
authorThomas Fillon <thomas@parisson.com>
Fri, 11 Sep 2015 09:17:48 +0000 (11:17 +0200)
committerThomas Fillon <thomas@parisson.com>
Fri, 11 Sep 2015 09:17:48 +0000 (11:17 +0200)
diggersdigest/records/templatetags/records_tags.py
diggersdigest/static/css/dig2.css
diggersdigest/templates/index.html
diggersdigest/templates/pages/category.html
diggersdigest/templates/shop/product.html

index 34480d5d6c62976b00802355295d0592f7d9707b..6992f640afad96ee6e12d6ffc7cb243dfcf446c8 100644 (file)
@@ -1,3 +1,5 @@
+from django.db.models import Q
+
 from mezzanine import template
 from cartridge.shop.models import Product, Category
 
@@ -15,7 +17,7 @@ def shop_recent_products(limit=5, category=None):
         {% blog_recent_posts limit=5 tag="django" as recent_posts %}
         {% blog_recent_posts limit=5 category="python" as recent_posts %}
     """
-    products = Product.objects.published()
+    products = Product.objects.published().filter(available=True)
     title_or_slug = lambda s: Q(title=s) | Q(slug=s)
 
     if category is not None:
index 55babe47925f687f443fc0714d7b5153b1bfb25d..8a6968aa8397920c68a4be34d9e94cbfb26a9ec7 100644 (file)
@@ -3,6 +3,11 @@
    ) repeat;
 }
 
+.slim_margins{
+  padding-right:1px;
+  padding-left:1px;
+}
+
 body {
     padding-top: 300px;
 }
@@ -14,4 +19,4 @@ hr {
     border-top: 2px solid #000;
     margin: 1em 0;
     padding: 0;
-}
\ No newline at end of file
+}
index bfad59d60263ac58d9fe6d9d875b1b2e90621de3..8c363a5c471894774a9e18b78a1d45a0923f4c5b 100644 (file)
@@ -9,25 +9,29 @@
 {% endblock %}
 
 {% block main %}
-{% blocktrans %}
-<h2>Congratulations!</h2>
-<p>
-    Welcome to your new Mezzanine powered website.
-    Here are some quick links to get you started:
-</p>
-<ul>
-    <li><a href="/admin/">Log in to the admin interface</a></li>
-    <li><a href="http://mezzanine.jupo.org/docs/content-architecture.html">Creating custom page types</a></li>
-    <li><a href="http://mezzanine.jupo.org/docs/frequently-asked-questions.html#templates">Modifying HTML templates</a></li>
-    <li><a href="http://mezzanine.jupo.org/docs/frequently-asked-questions.html#why-isn-t-the-homepage-a-page-object-i-can-edit-via-the-admin">Changing this homepage</a></li>
-    <li><a href="http://mezzanine.jupo.org/docs/frequently-asked-questions.html">Other frequently asked questions</a></li>
-    <li><a href="http://mezzanine.jupo.org/docs/configuration.html#default-settings">Full list of settings</a></li>
-    <li><a href="http://mezzanine.jupo.org/docs/deployment.html">Deploying to a production server</a></li>
-</ul>
-{% endblocktrans %}
 {% load blog_tags records_tags keyword_tags i18n mezzanine_tags %}
 <div class="col-xs-6 col-md-6"><!-- Showcase-->
-<h2>{% trans "Showcase" %}</h2>
+{% shop_recent_products limit=2 category="Showcase" as recent_products %}
+{% if recent_products %}
+<h2>{% trans "Showcases" %}</h2>
+<div class="row">
+  {% for product in recent_products %}
+    <div class="col-xs-12 col-md-12 product-thumb ">
+    <a href="{{ product.get_absolute_url }}" class="thumbnail">
+        {% if product.image %}
+          <img src="{{ MEDIA_URL }}{% thumbnail product.image 256 256 %}">
+        {% else %}
+          <div class="placeholder"></div>
+        {% endif %}
+        <div class="caption">
+        <h6>{{ product }}</h6>
+        </div>
+    </a>
+    </div>
+{% endfor %}
+</div>
+{% endif %}
+
 </div><!-- /Showcase -->
 <div class="col-xs-6 col-md-6"><!-- Latest Releases -->
 {% shop_recent_products 9 as recent_products %}
@@ -35,7 +39,7 @@
 <h2>{% trans "Latest Releases" %}</h2>
 <div class="row">
   {% for product in recent_products %}
-    <div class="col-xs-4 col-md-4 product-thumb ">
+    <div class="col-xs-4 col-md-4 product-thumb slim_margins">
     <a href="{{ product.get_absolute_url }}" class="thumbnail">
         {% if product.image %}
           <img src="{{ MEDIA_URL }}{% thumbnail product.image 148 148 %}">
index 3111148b35217cb2312bf0fe859e021e53bc1542..910be0527213553cc8e90c039869a58039e7c56f 100644 (file)
@@ -58,7 +58,7 @@
 
 <div class="row product-list">
 {% for product in products.object_list %}
-    <div class="col-xs-6 col-sm-4 col-lg-3 product-thumb">
+    <div class="col-xs-6 col-sm-4 col-lg-3 product-thumb slim_margins">
     <a href="{{ product.get_absolute_url }}" class="thumbnail">
         {% if product.image %}
         <img src="{{ MEDIA_URL }}{% thumbnail product.image 148 148 %}">
index 344c55ee694f89c0841541d750b7420a738c4c55..37b385d75fd50c3a8fa2ecde62f7bdfa151fbed0 100644 (file)
@@ -162,7 +162,7 @@ $(function () {
 <form method="post" id="add-cart" class="shop-form">
     {% fields_for add_product_form %}
     <div class="form-actions">
-        <input type="submit" class="btn btn-primary btn-lg pull-right" name="add_cart" value="{% trans "Buy" %}">
+        <input type="submit" class="btn btn-primary btn-lg pull-right" name="add_cart" value="{% trans "Add to cart" %}">
         {% if settings.SHOP_USE_WISHLIST %}
         <input type="submit" class="btn btn-default btn-lg pull-left" name="add_wishlist" value="{% trans "Save for later" %}">
         {% endif %}