Permalink
Browse files

dry'er templates

  • Loading branch information...
1 parent a50c8c6 commit 7283bd359271df5dd5b16abb73e40f959815afab @fivethreeo committed Nov 15, 2011
@@ -1,24 +1,18 @@
{% extends "cmsplugin_blog/cmsplugin_blog_base.html" %}
-{% load i18n placeholder_tags cmsplugin_blog_tags simple_translation_tags %}
+{% load i18n cmsplugin_blog_tags %}
{% block left-col %}
{{ block.super }}
<h1>{% trans "Latest entries" %}</h1>
-{% for entry in latest|annotate_with_translations %}
- {% with entry|get_preferred_translation_from_request:request as title %}
- {% with entry.placeholders|choose_placeholder:"excerpt" as excerpt %}
- <p>{{ entry.pub_date|date:"d b Y" }}<br/><a href="{{ title.get_absolute_url }}">{{ title }}</a>
- {{ entry|render_language_choices:request|safe }}
- </p>
- {% render_placeholder excerpt %}
- {% endwith %}
- {% endwith %}
-{% empty %}
+{% with latest as object_list %}
+{% if object_list %}
+ {% include "cmsplugin_blog/entry_list_include.html" %}
+{% else %}
<p>{% trans "No entries" %}</p>
-{% endfor %}
-
+{% endif %}
+{% endwith %}
{% endblock %}
@@ -1,22 +1,16 @@
{% extends "cmsplugin_blog/cmsplugin_blog_base.html" %}
-{% load i18n placeholder_tags cmsplugin_blog_tags simple_translation_tags %}
+{% load i18n cmsplugin_blog_tags %}
{% block left-col %}
{{ block.super }}
<h1>{% trans "Entries for" %} {{ day|date:"d F Y" }}</h1>
-{% for entry in object_list|annotate_with_translations %}
- {% with entry|get_preferred_translation_from_request:request as title %}
- {% with entry.placeholders|choose_placeholder:"excerpt" as excerpt %}
- <p>{{ entry.pub_date|date:"d b Y" }}<br/><a href="{{ title.get_absolute_url }}">{{ title }}</a>
- {{ entry|render_language_choices:request|safe }}
- </p>
- {% render_placeholder excerpt %}
- {% endwith %}
- {% endwith %}
-{% empty %}
+
+{% if object_list %}
+ {% include "cmsplugin_blog/entry_list_include.html" %}
+{% else %}
<p>{% trans "No entries for this day" %}</p>
-{% endfor %}
+{% endif %}
{% endblock %}
@@ -1,23 +1,16 @@
{% extends "cmsplugin_blog/cmsplugin_blog_base.html" %}
-{% load i18n placeholder_tags cmsplugin_blog_tags simple_translation_tags %}
+{% load i18n cmsplugin_blog_tags %}
{% block left-col %}
{{ block.super }}
<h1>{% trans "Entries for" %} {{ month|date:"F Y" }}</h1>
-{% for entry in object_list|annotate_with_translations %}
- {% with entry|get_preferred_translation_from_request:request as title %}
- {% with entry.placeholders|choose_placeholder:"excerpt" as excerpt %}
- <p>{{ entry.pub_date|date:"d b Y" }}<br/><a href="{{ title.get_absolute_url }}">{{ title }}</a>
- {{ entry|render_language_choices:request|safe }}
- </p>
- {% render_placeholder excerpt %}
- {% endwith %}
- {% endwith %}
-{% empty %}
+{% if object_list %}
+ {% include "cmsplugin_blog/entry_list_include.html" %}
+{% else %}
<p>{% trans "No entries for this month" %}</p>
-{% endfor %}
+{% endif %}
{% endblock %}
@@ -16,8 +16,6 @@
{% endblock %}
-
-
{% block right-col %}
{% render_author_links %}
@@ -1,5 +1,5 @@
{% extends "cmsplugin_blog/cmsplugin_blog_base.html" %}
-{% load i18n placeholder_tags cmsplugin_blog_tags simple_translation_tags %}
+{% load i18n cmsplugin_blog_tags %}
{% block extrahead %}
{{ block.super }}
@@ -12,19 +12,11 @@
<h1>{% trans "Entries by" %} {{ author }}</h1>
-{% for entry in object_list|annotate_with_translations %}
- {% with entry|get_preferred_translation_from_request:request as title %}
- {% with entry.placeholders|choose_placeholder:"excerpt" as excerpt %}
- <p>{{ entry.pub_date|date:"d b Y" }}<br/><a href="{{ title.get_absolute_url }}">{{ title }}</a>
- {{ entry|render_language_choices:request|safe }}
- </p>
- {% render_placeholder excerpt %}
- {% endwith %}
- {% endwith %}
-{% empty %}
+{% if object_list %}
+ {% include "cmsplugin_blog/entry_list_include.html" %}
+{% else %}
<p>{% trans "No entries by" %} {{ author }}</p>
-{% endfor %}
-
+{% endif %}
{% endblock %}
@@ -1,5 +1,5 @@
{% extends "cmsplugin_blog/cmsplugin_blog_base.html" %}
-{% load i18n placeholder_tags cmsplugin_blog_tags simple_translation_tags %}
+{% load i18n cmsplugin_blog_tags %}
{% block extrahead %}
{{ block.super }}
@@ -12,18 +12,11 @@
<h1>{% trans "Entries tagged" %} "{{ tag }}"</h1>
-{% for entry in object_list|annotate_with_translations %}
- {% with entry|get_preferred_translation_from_request:request as title %}
- {% with entry.placeholders|choose_placeholder:"excerpt" as excerpt %}
- <p>{{ entry.pub_date|date:"d b Y" }}<br/><a href="{{ title.get_absolute_url }}">{{ title }}</a>
- {{ entry|render_language_choices:request|safe }}
- </p>
- {% render_placeholder excerpt %}
- {% endwith %}
- {% endwith %}
-{% empty %}
+{% if object_list %}
+ {% include "cmsplugin_blog/entry_list_include.html" %}
+{% else %}
<p>{% trans "No entries tagged" %} "{{ tag }}"</p>
-{% endfor %}
+{% endif %}
{% endblock %}
@@ -0,0 +1,11 @@
+{% load i18n placeholder_tags cmsplugin_blog_tags simple_translation_tags %}
+{% for entry in object_list|annotate_with_translations %}
+ {% with entry|get_preferred_translation_from_request:request as title %}
+ {% with entry.placeholders|choose_placeholder:"excerpt" as excerpt %}
+ <p>{{ entry.pub_date|date:"d b Y" }}<br/><a href="{{ title.get_absolute_url }}">{{ title }}</a>
+ {{ entry|render_language_choices:request|safe }}
+ </p>
+ {% render_placeholder excerpt %}
+ {% endwith %}
+ {% endwith %}
+{% endfor %}
@@ -1,13 +1,6 @@
-{% load i18n placeholder_tags simple_translation_tags djangocms_utils_tags %}
-{% for entry in latest|annotate_with_translations %}
- {% with entry|get_preferred_translation_from_request:request as title %}
- {% with entry.placeholders|choose_placeholder:"excerpt" as excerpt %}
- <p>{{ entry.pub_date|date:"d b Y" }}<br/><a href="{{ title.get_absolute_url }}">{{ title }}</a>
- {{ entry|render_language_choices:request|safe }}
- </p>
- {% render_placeholder excerpt %}
- {% endwith %}
- {% endwith %}
-{% empty %}
+{% load i18n %}
+{% if object_list %}
+ {% include "cmsplugin_blog/entry_list_include.html" %}
+{% else %}
<p>{% trans "No entries" %}</p>
-{% endfor %}
+{% endif %}

0 comments on commit 7283bd3

Please sign in to comment.