From: Guillaume Pellerin Date: Mon, 21 Sep 2015 22:32:52 +0000 (+0200) Subject: add/fix prices, add title styles, restrict search models and ordering options X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=3f7e253ff50492075f7ffe576425d58b13849326;p=diggersdigest.git add/fix prices, add title styles, restrict search models and ordering options --- diff --git a/diggersdigest/diggersdigest/settings.py b/diggersdigest/diggersdigest/settings.py index 769e44b..b913314 100644 --- a/diggersdigest/diggersdigest/settings.py +++ b/diggersdigest/diggersdigest/settings.py @@ -167,6 +167,7 @@ BLOG_USE_FEATURED_IMAGE = True # INSTALLED_APPS setting. USE_MODELTRANSLATION = False +SEARCH_MODEL_CHOICES = ('cartridge.shop.Product',) ######################## # MAIN DJANGO SETTINGS # diff --git a/diggersdigest/static/css/dig2.css b/diggersdigest/static/css/dig2.css index 6acf905..3585fe6 100644 --- a/diggersdigest/static/css/dig2.css +++ b/diggersdigest/static/css/dig2.css @@ -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; } diff --git a/diggersdigest/templates/base.html b/diggersdigest/templates/base.html index 517e1f6..449b7c0 100644 --- a/diggersdigest/templates/base.html +++ b/diggersdigest/templates/base.html @@ -19,7 +19,6 @@ - {% if LANGUAGE_BIDI %} {% endif %} @@ -28,6 +27,7 @@ {% if LANGUAGE_BIDI %} {% endif %} + {% endifinstalled %} {% block extra_css %}{% endblock %} {% endcompress %} @@ -95,20 +95,20 @@

{% block title %}{% endblock %}

- +{% endcomment %}
-{% comment - Remove left panel%} +{% comment - Remove left panel %}
{% block left_panel %}
{% page_menu "pages/menus/tree.html" %}
diff --git a/diggersdigest/templates/blog/blog_post_detail.html b/diggersdigest/templates/blog/blog_post_detail.html new file mode 100644 index 0000000..2f861bc --- /dev/null +++ b/diggersdigest/templates/blog/blog_post_detail.html @@ -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 }} +
  • {{ blog_post.title }}
  • +{% endblock %} + +{% block main %} + +{% block blog_post_detail_postedby %} +{% editable blog_post.publish_date %} + +{% endeditable %} +{% endblock %} +{% block blog_post_detail_commentlink %} +

    + {% if blog_post.allow_comments %} + {% if settings.COMMENTS_DISQUS_SHORTNAME %} + ({% spaceless %} + {% trans "Comments" %} + {% endspaceless %}) + {% else %}({% spaceless %} + {% blocktrans count comments_count=blog_post.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %} + {% endspaceless %}) + {% endif %} + {% endif %} +

    +{% endblock %} + +{% block blog_post_detail_featured_image %} +{% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %} +

    +{% 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 %} +
      +
    • {% trans "Tags" %}:
    • + {% for tag in tags %} +
    • {{ tag }}{% if not forloop.last %}, {% endif %}
    • + {% endfor %} +
    +{% endspaceless %} +{% endif %} +{% endblock %} + +{% block blog_post_detail_rating %} +
    +
    + {% rating_for blog_post %} +
    +
    +{% endblock %} + +{% block blog_post_detail_sharebuttons %} +{% set_short_url_for blog_post %} + + +{% endblock %} + +{% block blog_post_previous_next %} +
      +{% with blog_post.get_previous_by_publish_date as previous %} +{% if previous %} + +{% endif %} +{% endwith %} +{% with blog_post.get_next_by_publish_date as next %} +{% if next %} + +{% endif %} +{% endwith %} +
    +{% endblock %} + +{% block blog_post_detail_related_posts %} +{% if related_posts %} + +{% 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 index 0000000..21ddf51 --- /dev/null +++ b/diggersdigest/templates/blog/blog_post_list.html @@ -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 %} +
  • {% 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 %} +
  • +{% endif %} +{% endblock %} + +{% block main %} + +{% if tag or category or year or month or author %} + {% block blog_post_list_filterinfo %} +

    + {% 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 %} +

    +{% 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 %} +

    + {{ blog_post.title }} +

    +{% endeditable %} +{% endblock %} +{% block blog_post_list_post_metainfo %} +{% editable blog_post.publish_date %} + +{% endeditable %} +{% endblock %} + +{% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %} +{% block blog_post_list_post_featured_image %} + + + +{% 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 %} +
    + {% keywords_for blog_post as tags %} + {% if tags %} +
      + {% trans "Tags" %}: + {% spaceless %} + {% for tag in tags %} +
    • {{ tag }}{% if not forloop.last %}, {% endif %}
    • + {% endfor %} + {% endspaceless %} +
    + {% endif %} +

    + {% trans "read more" %} + {% if blog_post.allow_comments %} + / + {% if settings.COMMENTS_DISQUS_SHORTNAME %} + + {% trans "Comments" %} + + {% else %} + + {% blocktrans count comments_count=blog_post.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %} + + {% endif %} + {% endif %} +

    +
    +{% 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 index 0000000..d2817d8 --- /dev/null +++ b/diggersdigest/templates/blog/includes/filter_panel.html @@ -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 %} +

    {% trans "Recent Posts" %}

    + +{% endif %} +{% endblock %} + +{% block blog_months %} +{% blog_months as months %} +{% if months %} +

    {% trans "Archive" %}

    +{% for month in months %} + {% ifchanged month.date.year %} + {% if not forloop.first %}{% endif %} +
    {{ month.date.year }}
    +{% endif %} +{% endblock %} + +{% block blog_categories %} +{% blog_categories as categories %} +{% if categories %} +

    {% trans "Categories" %}

    +
      +{% for category in categories %} +
    • {{ category }} ({{ category.post_count }})
    • +{% endfor %} +
    +{% endif %} +{% endblock %} + +{% block blog_keywords %} +{% keywords_for blog.blogpost as tags %} +{% if tags %} +

    {% trans "Tags" %}

    +
      +{% for tag in tags %} +
    • + {{ tag }} + ({{ tag.item_count }}) +
    • +{% endfor %} +
    +{% endif %} +{% endblock %} + +{% block blog_authors %} +{% blog_authors as authors %} +{% if authors %} +

    {% trans "Authors" %}

    + +{% endif %} +{% endblock %} + +{% block blog_feeds %} +

    {% trans "Feeds" %}

    +{% if tag %} + {% trans "RSS" %} / + {% trans "Atom" %} +{% endif %} +{% if category %} + {% trans "RSS" %} / + {% trans "Atom" %} +{% endif %} +{% if author %} + {% trans "RSS" %} / + {% trans "Atom" %} +{% endif %} +{% if not tag and not category and not author %} + {% trans "RSS" %} / + {% trans "Atom" %} +{% endif %} +{% endblock %} diff --git a/diggersdigest/templates/index.html b/diggersdigest/templates/index.html index 8c363a5..6ef2789 100644 --- a/diggersdigest/templates/index.html +++ b/diggersdigest/templates/index.html @@ -2,7 +2,9 @@ {% load i18n %} {% block meta_title %}{% trans "Home" %}{% endblock %} +{% comment %} {% block title %}{% trans "Home" %}{% endblock %} +{% endcomment %} {% block breadcrumb_menu %}
  • {% trans "Home" %}
  • @@ -10,10 +12,11 @@ {% block main %} {% load blog_tags records_tags keyword_tags i18n mezzanine_tags %} +
    {% shop_recent_products limit=2 category="Showcase" as recent_products %} {% if recent_products %} -

    {% trans "Showcases" %}

    +

    {% trans "Showcases" %}

    {% for product in recent_products %}
    @@ -25,6 +28,9 @@ {% endif %}
    {{ product }}
    + {% with product.variations.all as variations %} + {% include "shop/includes/price.html" %} + {% endwith %}
    @@ -33,10 +39,11 @@ {% endif %}
    +
    {% shop_recent_products 9 as recent_products %} {% if recent_products %} -

    {% trans "Latest Releases" %}

    +

    {% trans "Latest Releases" %}

    {% for product in recent_products %}
    @@ -47,7 +54,7 @@
    {% endif %}
    -
    {{ product }}
    +
    {{ product.record }}
    @@ -55,6 +62,7 @@
    {% endif %}
    +
    {% 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 index 0000000..8df59a5 --- /dev/null +++ b/diggersdigest/templates/shop/includes/price.html @@ -0,0 +1,22 @@ +{% load staticfiles mezzanine_tags shop_tags records_tags rating_tags i18n %} + +
      + {% for variation in variations %} +
    • + {% if variation.has_price %} + {% if variation.on_sale %} + {{ variation.unit_price|currency }} + {% trans "On sale:" %} + {% endif %} + {% trans "Price" %}: {{ variation.price|currency }} + {% else %} + {% if has_available_variations %} + + {% trans "The selected options are currently unavailable." %} + + {% endif %} + {% endif %} +
    • + {% endfor %} +
    diff --git a/diggersdigest/templates/shop/product.html b/diggersdigest/templates/shop/product.html index 70414e4..3bb21b0 100644 --- a/diggersdigest/templates/shop/product.html +++ b/diggersdigest/templates/shop/product.html @@ -128,6 +128,7 @@ $(function () { {{ product.record.vinyl_condition.abbr }} +
  • {% include "shop/includes/price.html" %}
  • {% if product.record.audio_file %} @@ -146,31 +147,11 @@ $(function () {
    {% if product.available and has_available_variations %} -
      - {% for variation in variations %} -
    • - {% if variation.has_price %} - {% if variation.on_sale %} - {{ variation.unit_price|currency }} - {% trans "On sale:" %} - {% endif %} - {{ variation.price|currency }} - {% else %} - {% if has_available_variations %} - - {% trans "The selected options are currently unavailable." %} - - {% endif %} - {% endif %} -
    • - {% endfor %} -
    {% errors_for add_product_form %}
    - {% fields_for add_product_form %} +
    {% if settings.SHOP_USE_WISHLIST %}