]> git.0d.be Git - panikweb.git/commitdiff
performance: turn news 'inline' template into a template tag
authorFrédéric Péters <fpeters@0d.be>
Fri, 23 Aug 2013 22:34:24 +0000 (00:34 +0200)
committerFrédéric Péters <fpeters@0d.be>
Fri, 23 Aug 2013 22:34:24 +0000 (00:34 +0200)
panikweb/paniktags/templatetags/paniktags.py
panikweb_templates/templates/news.html

index 66fb02cc83cb52dfddc78a21e347737603ac6710..3f61e97ea36c797a8ba26312c524bb5b7e871cd3 100644 (file)
@@ -36,3 +36,11 @@ def player():
 @register.inclusion_tag('includes/metaNav.html', takes_context=False)
 def metanav():
     return {}
+
+@register.inclusion_tag('news/inline.html', takes_context=False)
+def news_inline(content=None, klass=None, logo=None):
+    return {
+            'content': content,
+            'class': klass,
+            'logo': logo
+    }
index 851760b7d748ec11b7eb521716fa5f0eb9f9d2f4..f45b40cec2a2197885ed05d4e46c1d80335ff1b4 100644 (file)
@@ -1,4 +1,5 @@
 {% extends "base.html"%}
+{% load paniktags %}
 {% block bodyID %}News{% endblock %}
 {% block title %}News{% endblock %}
 {% block nav %}
                {% for NewsItem in newsImaged %}
                        <li class="item num-{{forloop.counter}}">
                        {% if NewsItem.slug == newsImaged.0.slug %}
-                               {% include "news/inline.html" with content=NewsItem class="special" logo="large"%}
+                               {% news_inline content=NewsItem klass="special" logo="large" %}
                        {% elif NewsItem.slug == newsImaged.1.slug or NewsItem.slug == newsImaged.2.slug%}
-                               {% include "news/inline.html" with content=NewsItem class="special" logo="medium"%}
+                               {% news_inline content=NewsItem klass="special" logo="medium"%}
                        {% else %}
-                               {% include "news/inline.html" with content=NewsItem%}
+                               {% news_inline with content=NewsItem%}
                        {% endif %}
                        </li>
                {% endfor %}