]> git.parisson.com Git - diggersdigest.git/commitdiff
add/fix prices, add title styles, restrict search models and ordering options
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 21 Sep 2015 22:32:52 +0000 (00:32 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 21 Sep 2015 22:32:52 +0000 (00:32 +0200)
diggersdigest/diggersdigest/settings.py
diggersdigest/static/css/dig2.css
diggersdigest/templates/base.html
diggersdigest/templates/blog/blog_post_detail.html [new file with mode: 0644]
diggersdigest/templates/blog/blog_post_list.html [new file with mode: 0644]
diggersdigest/templates/blog/includes/filter_panel.html [new file with mode: 0644]
diggersdigest/templates/index.html
diggersdigest/templates/shop/includes/price.html [new file with mode: 0644]
diggersdigest/templates/shop/product.html

index 769e44b1d4e7439b86d91d5543751c936a293b3c..b913314cc330e8b0f7d54f694846ad54217c4926 100644 (file)
@@ -167,6 +167,7 @@ BLOG_USE_FEATURED_IMAGE = True
 # INSTALLED_APPS setting.
 USE_MODELTRANSLATION = False
 
+SEARCH_MODEL_CHOICES = ('cartridge.shop.Product',)
 
 ########################
 # MAIN DJANGO SETTINGS #
index 6acf9053daea2dc9898aeb3987033e5b8fb72478..3585fe6b7209f4192266c0a2a3eede58e23996a7 100644 (file)
@@ -21,6 +21,11 @@ hr {
     padding: 0;
 }
 
+.bg-white {
+    background-color: white;
+    padding: 5px;
+}
+
 .description {
     background-color: white;
     padding: 1em 1em 1em 2em;
@@ -34,6 +39,8 @@ hr {
     margin-bottom: 30px;
 }
 
-.price .old-price {
+.price:only-child, .coming-soon {
+    margin-top: 3px;
+    display: block;
     font-weight: bold;
 }
index 517e1f6c008fef9439f0499e7f09b45404c1a71d..449b7c078a08e9048f8d19d2bcd8c9a3268aff99 100644 (file)
@@ -19,7 +19,6 @@
 <link rel="stylesheet" href="{% static "css/bootstrap.css" %}">
 <link rel="stylesheet" href="{% static "css/mezzanine.css" %}">
 <link rel="stylesheet" href="{% static "css/bootstrap-theme.css" %}">
-<link rel="stylesheet" href="{% static "css/dig2.css" %}">
 {% if LANGUAGE_BIDI %}
 <link rel="stylesheet" href="{% static "css/bootstrap-rtl.css" %}">
 {% endif %}
@@ -28,6 +27,7 @@
 {% if LANGUAGE_BIDI %}
 <link rel="stylesheet" href="{% static "css/cartridge.rtl.css" %}">
 {% endif %}
+<link rel="stylesheet" href="{% static "css/dig2.css" %}">
 {% endifinstalled %}
 {% block extra_css %}{% endblock %}
 {% endcompress %}
 
 <h1>{% block title %}{% endblock %}</h1>
 
-<!--
+{% comment - Remove breadcrumbs %}
 <ul class="breadcrumb">
 {% spaceless %}
 {% block breadcrumb_menu %}{% page_menu "pages/menus/breadcrumb.html" %}{% endblock %}
 {% endspaceless %}
 </ul>
--->
+{% endcomment %}
 
 </div>
 
 <div class="container">
 <div class="row">
 
-{% comment - Remove left panel%}
+{% comment - Remove left panel %}
 <div class="col-md-2 left">
     {% block left_panel %}
     <div class="panel panel-default tree">{% page_menu "pages/menus/tree.html" %}</div>
diff --git a/diggersdigest/templates/blog/blog_post_detail.html b/diggersdigest/templates/blog/blog_post_detail.html
new file mode 100644 (file)
index 0000000..2f861bc
--- /dev/null
@@ -0,0 +1,133 @@
+{% extends "blog/blog_post_list.html" %}
+{% load mezzanine_tags comment_tags keyword_tags rating_tags i18n disqus_tags %}
+
+{% block meta_title %}{{ blog_post.meta_title }}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for blog_post as tags %}
+{% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block meta_description %}{% metablock %}
+{{ blog_post.description }}
+{% endmetablock %}{% endblock %}
+
+{% block title %}
+{% editable blog_post.title %}{{ blog_post.title }}{% endeditable %}
+{% endblock %}
+
+{% block breadcrumb_menu %}
+{{ block.super }}
+<li class="active">{{ blog_post.title }}</li>
+{% endblock %}
+
+{% block main %}
+
+{% block blog_post_detail_postedby %}
+{% editable blog_post.publish_date %}
+<h6 class="post-meta">
+    {% trans "Posted by" %}:
+    {% with blog_post.user as author %}
+    <a href="{% url "blog_post_list_author" author %}">{{ author.get_full_name|default:author.username }}</a>
+    {% endwith %}
+    {% blocktrans with sometime=blog_post.publish_date|timesince %}{{ sometime }} ago{% endblocktrans %}
+</h6>
+{% endeditable %}
+{% endblock %}
+{% block blog_post_detail_commentlink %}
+<p>
+    {% if blog_post.allow_comments %}
+        {% if settings.COMMENTS_DISQUS_SHORTNAME %}
+            (<a href="{{ blog_post.get_absolute_url }}#disqus_thread"
+                data-disqus-identifier="{% disqus_id_for blog_post %}">{% spaceless %}
+                {% trans "Comments" %}
+            {% endspaceless %}</a>)
+        {% else %}(<a href="#comments">{% spaceless %}
+            {% blocktrans count comments_count=blog_post.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
+            {% endspaceless %}</a>)
+        {% endif %}
+    {% endif %}
+</p>
+{% endblock %}
+
+{% block blog_post_detail_featured_image %}
+{% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %}
+<p><img class="img-responsive" src="{{ MEDIA_URL }}{% thumbnail blog_post.featured_image 600 0 %}"></p>
+{% endif %}
+{% endblock %}
+
+{% if settings.COMMENTS_DISQUS_SHORTNAME %}
+{% include "generic/includes/disqus_counts.html" %}
+{% endif %}
+
+{% block blog_post_detail_content %}
+{% editable blog_post.content %}
+{{ blog_post.content|richtext_filters|safe }}
+{% endeditable %}
+{% endblock %}
+
+{% block blog_post_detail_keywords %}
+{% keywords_for blog_post as tags %}
+{% if tags %}
+{% spaceless %}
+<ul class="list-inline tags">
+    <li>{% trans "Tags" %}:</li>
+    {% for tag in tags %}
+    <li><a href="{% url "blog_post_list_tag" tag.slug %}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}</li>
+    {% endfor %}
+</ul>
+{% endspaceless %}
+{% endif %}
+{% endblock %}
+
+{% block blog_post_detail_rating %}
+<div class="panel panel-default rating">
+    <div class="panel-body">
+    {% rating_for blog_post %}
+    </div>
+</div>
+{% endblock %}
+
+{% block blog_post_detail_sharebuttons %}
+{% set_short_url_for blog_post %}
+<a class="btn btn-sm share-twitter" target="_blank" href="http://twitter.com/home?status={{ blog_post.short_url|urlencode }}%20{{ blog_post.title|urlencode }}">{% trans "Share on Twitter" %}</a>
+<a class="btn btn-sm share-facebook" target="_blank" href="http://facebook.com/sharer.php?u={{ request.build_absolute_uri }}&amp;t={{ blog_post.title|urlencode }}">{% trans "Share on Facebook" %}</a>
+{% endblock %}
+
+{% block blog_post_previous_next %}
+<ul class="pager">
+{% with blog_post.get_previous_by_publish_date as previous %}
+{% if previous %}
+<li class="previous">
+    <a href="{{ previous.get_absolute_url }}">&larr; {{ previous }}</a>
+</li>
+{% endif %}
+{% endwith %}
+{% with blog_post.get_next_by_publish_date as next %}
+{% if next %}
+<li class="next">
+    <a href="{{ next.get_absolute_url }}">{{ next }} &rarr;</a>
+</li>
+{% endif %}
+{% endwith %}
+</ul>
+{% endblock %}
+
+{% block blog_post_detail_related_posts %}
+{% if related_posts %}
+<div id="related-posts">
+<h3>{% trans 'Related posts' %}</h3>
+<ul class="list-unstyled">
+{% for post in related_posts %}
+     <li><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></li>
+{% endfor %}
+</ul>
+</div>
+{% endif %}
+{% endblock %}
+
+{% block blog_post_detail_comments %}
+{% if blog_post.allow_comments %}{% comments_for blog_post %}{% endif %}
+{% endblock %}
+
+{% endblock %}
diff --git a/diggersdigest/templates/blog/blog_post_list.html b/diggersdigest/templates/blog/blog_post_list.html
new file mode 100644 (file)
index 0000000..21ddf51
--- /dev/null
@@ -0,0 +1,159 @@
+{% extends "base.html" %}
+{% load i18n mezzanine_tags blog_tags keyword_tags disqus_tags %}
+
+{% block meta_title %}{% if page %}{{ page.meta_title }}{% else %}{% trans "Blog" %}{% endif %}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for page as keywords %}
+{% for keyword in keywords %}
+    {% if not forloop.first %}, {% endif %}
+    {{ keyword }}
+{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block meta_description %}{% metablock %}
+{{ page.description }}
+{% endmetablock %}{% endblock %}
+
+{% block title %}
+{% if page %}
+{% editable page.title %}{{ page.title }}{% endeditable %}
+{% else %}
+{% trans "Blog" %}
+{% endif %}
+{% endblock %}
+
+{% block breadcrumb_menu %}
+{{ block.super }}
+{% if tag or category or year or month or author %}
+<li>{% spaceless %}
+{% if tag %}
+    {% trans "Tag:" %} {{ tag }}
+{% else %}{% if category %}
+    {% trans "Category:" %} {{ category }}
+{% else %}{% if year or month %}
+    {% if month %}{{ month }}, {% endif %}{{ year }}
+{% else %}{% if author %}
+    {% trans "Author:" %} {{ author.get_full_name|default:author.username }}
+{% endif %}{% endif %}{% endif %}{% endif %}
+{% endspaceless %}
+</li>
+{% endif %}
+{% endblock %}
+
+{% block main %}
+
+{% if tag or category or year or month or author %}
+    {% block blog_post_list_filterinfo %}
+    <p>
+    {% if tag %}
+        {% trans "Viewing posts tagged" %} {{ tag }}
+    {% else %}{% if category %}
+        {% trans "Viewing posts for the category" %} {{ category }}
+    {% else %}{% if year or month %}
+        {% trans "Viewing posts from" %} {% if month %}{{ month }}, {% endif %}
+        {{ year }}
+    {% else %}{% if author %}
+        {% trans "Viewing posts by" %}
+        {{ author.get_full_name|default:author.username }}
+    {% endif %}{% endif %}{% endif %}{% endif %}
+    {% endblock %}
+    </p>
+{% else %}
+    {% if page %}
+    {% block blog_post_list_pagecontent %}
+    {% if page.get_content_model.content %}
+        {% editable page.get_content_model.content %}
+        {{ page.get_content_model.content|richtext_filters|safe }}
+        {% endeditable %}
+    {% endif %}
+    {% endblock %}
+    {% endif %}
+{% endif %}
+
+{% for blog_post in blog_posts.object_list %}
+{% block blog_post_list_post_title %}
+{% editable blog_post.title %}
+<h2>
+    <a href="{{ blog_post.get_absolute_url }}">{{ blog_post.title }}</a>
+</h2>
+{% endeditable %}
+{% endblock %}
+{% block blog_post_list_post_metainfo %}
+{% editable blog_post.publish_date %}
+<h6 class="post-meta">
+    {% trans "Posted by" %}:
+    {% with blog_post.user as author %}
+    <a href="{% url "blog_post_list_author" author %}">{{ author.get_full_name|default:author.username }}</a>
+    {% endwith %}
+    {% with blog_post.categories.all as categories %}
+    {% if categories %}
+    {% trans "in" %}
+    {% for category in categories %}
+    <a href="{% url "blog_post_list_category" category.slug %}">{{ category }}</a>{% if not forloop.last %}, {% endif %}
+    {% endfor %}
+    {% endif %}
+    {% endwith %}
+    {% blocktrans with sometime=blog_post.publish_date|timesince %}{{ sometime }} ago{% endblocktrans %}
+</h6>
+{% endeditable %}
+{% endblock %}
+
+{% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %}
+{% block blog_post_list_post_featured_image %}
+<a href="{{ blog_post.get_absolute_url }}">
+    <img class="img-thumbnail pull-left" src="{{ MEDIA_URL }}{% thumbnail blog_post.featured_image 90 90 %}">
+</a>
+{% endblock %}
+{% endif %}
+
+{% block blog_post_list_post_content %}
+{% editable blog_post.content %}
+{{ blog_post.description_from_content|safe }}
+{% endeditable %}
+{% endblock %}
+
+{% block blog_post_list_post_links %}
+<div class="blog-list-detail">
+    {% keywords_for blog_post as tags %}
+    {% if tags %}
+    <ul class="list-inline tags">
+    {% trans "Tags" %}:
+    {% spaceless %}
+    {% for tag in tags %}
+    <li><a href="{% url "blog_post_list_tag" tag.slug %}" class="tag">{{ tag }}</a>{% if not forloop.last %}, {% endif %}</li>
+    {% endfor %}
+    {% endspaceless %}
+    </ul>
+    {% endif %}
+    <p>
+    <a href="{{ blog_post.get_absolute_url }}">{% trans "read more" %}</a>
+    {% if blog_post.allow_comments %}
+    /
+    {% if settings.COMMENTS_DISQUS_SHORTNAME %}
+    <a href="{{ blog_post.get_absolute_url }}#disqus_thread"
+        data-disqus-identifier="{% disqus_id_for blog_post %}">
+        {% trans "Comments" %}
+    </a>
+    {% else %}
+    <a href="{{ blog_post.get_absolute_url }}#comments">
+        {% blocktrans count comments_count=blog_post.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
+    </a>
+    {% endif %}
+    {% endif %}
+    </p>
+</div>
+{% endblock %}
+{% endfor %}
+
+{% pagination_for blog_posts %}
+
+{% if settings.COMMENTS_DISQUS_SHORTNAME %}
+{% include "generic/includes/disqus_counts.html" %}
+{% endif %}
+
+{% endblock %}
+
+{% block right_panel %}
+{% include "blog/includes/filter_panel.html" %}
+{% endblock %}
diff --git a/diggersdigest/templates/blog/includes/filter_panel.html b/diggersdigest/templates/blog/includes/filter_panel.html
new file mode 100644 (file)
index 0000000..d2817d8
--- /dev/null
@@ -0,0 +1,101 @@
+{% load blog_tags keyword_tags mezzanine_tags i18n %}
+
+{% block blog_recent_posts %}
+{% blog_recent_posts 5 as recent_posts %}
+{% if recent_posts %}
+<h3>{% trans "Recent Posts" %}</h3>
+<ul class="list-unstyled recent-posts">
+{% for recent_post in recent_posts %}
+<li>
+    {% spaceless %}
+    <a href="{{ recent_post.get_absolute_url }}">
+        {% if settings.BLOG_USE_FEATURED_IMAGE and recent_post.featured_image %}
+        <img src="{{ MEDIA_URL }}{% thumbnail recent_post.featured_image 24 24 %}">
+        {% endif %}
+    {{ recent_post.title }}
+    </a>
+    {% endspaceless %}
+</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block blog_months %}
+{% blog_months as months %}
+{% if months %}
+<h3>{% trans "Archive" %}</h3>
+{% for month in months %}
+    {% ifchanged month.date.year %}
+        {% if not forloop.first %}</ul>{% endif %}
+        <h6>{{ month.date.year }}</h6><ul class="list-unstyled">
+    {% endifchanged %}
+    <li><a href="{% url "blog_post_list_month" year=month.date.year month=month.date.month %}"
+        >{{ month.date|date:"F" }}</a> ({{ month.post_count }})</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block blog_categories %}
+{% blog_categories as categories %}
+{% if categories %}
+<h3>{% trans "Categories" %}</h3>
+<ul class="list-unstyled">
+{% for category in categories %}
+<li><a href="{% url "blog_post_list_category" category.slug %}"
+    >{{ category }}</a> ({{ category.post_count }})</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block blog_keywords %}
+{% keywords_for blog.blogpost as tags %}
+{% if tags %}
+<h3>{% trans "Tags" %}</h3>
+<ul class="list-inline tag-cloud">
+{% for tag in tags %}
+<li>
+    <a href="{% url "blog_post_list_tag" tag.slug %}"
+        class="tag-weight-{{ tag.weight }}">{{ tag }}</a>
+    ({{ tag.item_count }})
+</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block blog_authors %}
+{% blog_authors as authors %}
+{% if authors %}
+<h3>{% trans "Authors" %}</h3>
+<ul class="list-unstyled">
+{% for author in authors %}
+    <li><a href="{% url "blog_post_list_author" author.username %}"
+        >{{ author.get_full_name|default:author.username }}</a>
+        ({{ author.post_count }})</li>
+{% endfor %}
+</ul>
+{% endif %}
+{% endblock %}
+
+{% block blog_feeds %}
+<h3>{% trans "Feeds" %}</h3>
+{% if tag %}
+    <a href="{% url "blog_post_feed_tag" tag.slug "rss" %}">{% trans "RSS" %}</a> /
+    <a href="{% url "blog_post_feed_tag" tag.slug "atom" %}">{% trans "Atom" %}</a>
+{% endif %}
+{% if category %}
+    <a href="{% url "blog_post_feed_category" category.slug "rss" %}">{% trans "RSS" %}</a> /
+    <a href="{% url "blog_post_feed_category" category.slug "atom" %}">{% trans "Atom" %}</a>
+{% endif %}
+{% if author %}
+    <a href="{% url "blog_post_feed_author" author.username "rss" %}">{% trans "RSS" %}</a> /
+    <a href="{% url "blog_post_feed_author" author.username "atom" %}">{% trans "Atom" %}</a>
+{% endif %}
+{% if not tag and not category and not author %}
+    <a href="{% url "blog_post_feed" "rss" %}">{% trans "RSS" %}</a> /
+    <a href="{% url "blog_post_feed" "atom" %}">{% trans "Atom" %}</a>
+{% endif %}
+{% endblock %}
index 8c363a5c471894774a9e18b78a1d45a0923f4c5b..6ef27895aa196b16e4b4e514f60292da509a82e0 100644 (file)
@@ -2,7 +2,9 @@
 {% load i18n %}
 
 {% block meta_title %}{% trans "Home" %}{% endblock %}
+{% comment %}
 {% block title %}{% trans "Home" %}{% endblock %}
+{% endcomment %}
 
 {% block breadcrumb_menu %}
 <li class="active">{% trans "Home" %}</li>
 
 {% block main %}
 {% load blog_tags records_tags keyword_tags i18n mezzanine_tags %}
+
 <div class="col-xs-6 col-md-6"><!-- Showcase-->
 {% shop_recent_products limit=2 category="Showcase" as recent_products %}
 {% if recent_products %}
-<h2>{% trans "Showcases" %}</h2>
+<h2><span class="bg-white">{% trans "Showcases" %}</span></h2>
 <div class="row">
   {% for product in recent_products %}
     <div class="col-xs-12 col-md-12 product-thumb ">
@@ -25,6 +28,9 @@
         {% endif %}
         <div class="caption">
         <h6>{{ product }}</h6>
+        {% with product.variations.all as variations %}
+        {% include "shop/includes/price.html" %}
+        {% endwith %}
         </div>
     </a>
     </div>
 {% endif %}
 
 </div><!-- /Showcase -->
+
 <div class="col-xs-6 col-md-6"><!-- Latest Releases -->
 {% shop_recent_products 9 as recent_products %}
 {% if recent_products %}
-<h2>{% trans "Latest Releases" %}</h2>
+<h2><span class="bg-white">{% trans "Latest Releases" %}</span></h2>
 <div class="row">
   {% for product in recent_products %}
     <div class="col-xs-4 col-md-4 product-thumb slim_margins">
@@ -47,7 +54,7 @@
           <div class="placeholder"></div>
         {% endif %}
         <div class="caption">
-        <h6>{{ product }}</h6>
+        <h6>{{ product.record }}</h6>
         </div>
     </a>
     </div>
@@ -55,6 +62,7 @@
 </div>
 {% endif %}
 </div><!-- /Latest Releases -->
+
 <div><!-- Recent Posts -->
 {% blog_recent_posts 5 as recent_posts %}
 {% if recent_posts %}
diff --git a/diggersdigest/templates/shop/includes/price.html b/diggersdigest/templates/shop/includes/price.html
new file mode 100644 (file)
index 0000000..8df59a5
--- /dev/null
@@ -0,0 +1,22 @@
+{% load staticfiles mezzanine_tags shop_tags records_tags rating_tags i18n %}
+
+<ul id="variations" class="list-unstyled">
+    {% for variation in variations %}
+    <li id="variation-{{ variation.sku }}"
+        {% if not variation.default %}style="display:none;"{% endif %}>
+        {% if variation.has_price %}
+            {% if variation.on_sale %}
+                <span class="old-price">{{ variation.unit_price|currency }}</span>
+                {% trans "On sale:" %}
+            {% endif %}
+            <span class="price">{% trans "Price" %}: {{ variation.price|currency }}</span>
+        {% else %}
+            {% if has_available_variations %}
+            <span class="error-msg">
+            {% trans "The selected options are currently unavailable." %}
+            </span>
+            {% endif %}
+        {% endif %}
+    </li>
+    {% endfor %}
+</ul>
index 70414e461c12a364ac770cab0edc81709011092c..3bb21b0d63df70fefc383884863db3f6e7bbb668 100644 (file)
@@ -128,6 +128,7 @@ $(function () {
     {{ product.record.vinyl_condition.abbr }}
     </a>
   </li>
+  <li>{% include "shop/includes/price.html" %}</li>
 </ul>
 
 {% if product.record.audio_file %}
@@ -146,31 +147,11 @@ $(function () {
 </div>
 
 {% if product.available and has_available_variations %}
-<ul id="variations" class="list-unstyled">
-    {% for variation in variations %}
-    <li id="variation-{{ variation.sku }}"
-        {% if not variation.default %}style="display:none;"{% endif %}>
-        {% if variation.has_price %}
-            {% if variation.on_sale %}
-                <span class="old-price">{{ variation.unit_price|currency }}</span>
-                {% trans "On sale:" %}
-            {% endif %}
-            <span class="price">{{ variation.price|currency }}</span>
-        {% else %}
-            {% if has_available_variations %}
-            <span class="error-msg">
-            {% trans "The selected options are currently unavailable." %}
-            </span>
-            {% endif %}
-        {% endif %}
-    </li>
-    {% endfor %}
-</ul>
 
 {% errors_for add_product_form %}
 
 <form method="post" id="add-cart" class="shop-form">
-    {% fields_for add_product_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 "Add to cart" %}">
         {% if settings.SHOP_USE_WISHLIST %}