]> git.0d.be Git - panikweb.git/commitdiff
topiks: use a flat list for pages
authorFrédéric Péters <fpeters@0d.be>
Fri, 21 Apr 2017 15:58:14 +0000 (17:58 +0200)
committerFrédéric Péters <fpeters@0d.be>
Fri, 21 Apr 2017 15:58:14 +0000 (17:58 +0200)
panikweb/paniktags/templatetags/paniktags.py
panikweb_templates/templates/combo/page_template_sidebar.html
panikweb_templates/templates/combo/topik_menu_item.html [new file with mode: 0644]

index 81d15d74b2e0383696fcc75facef2131e17306b8..4ca73326ac5bab7530483d5eb09a473854546a11 100644 (file)
@@ -16,6 +16,8 @@ from datetime import datetime, timedelta
 from emissions.models import Emission, Episode, NewsItem, SoundFile, Focus
 from emissions.utils import period_program
 
+from panikombo.models import Topik
+
 from panikweb import utils
 from panikweb import search
 
@@ -348,3 +350,13 @@ def get_focus_url(object):
 @register.filter
 def facet_tag(tag):
     return tag.name
+
+
+@register.filter
+def image_file(page):
+    try:
+        matching_topik = Topik.objects.get(page=page)
+        return matching_topik.image
+    except Topik.DoesNotExist:
+        pass
+    return None
index 7f1a03063457d5cff6ad31e0071816fbe298d852..bd00b18502f66d5a4b9684647aa27c0cda560c51 100644 (file)
                {% endif %}
                <div class="text">{% placeholder "content" %}</div>
        </div>
-       <div id="fiber-nav" class="sub rightPart custom marged">
-               {% block menu %}{% show_menu level=1 depth=2 %}{% endblock %}
+       <div class="sub rightPart custom marged">
+               <ul class="custom list">
+               {% for page in page.get_parents_and_self.0.get_children %}
+                 {% if page.public and not page.exclude_from_navigation %}
+                   {% if page.has_children %}
+                     {% for subpage in page.get_children %}
+                       {% include "combo/topik_menu_item.html" with page=subpage only %}
+                     {% endfor %}
+                   {% else %}
+                     {% include "combo/topik_menu_item.html" with page=page only %}
+                   {% endif %}
+                 {% endif %}
+               {% endfor %}
+               </ul>
                {% placeholder "sidebar" %}
        </div>
 </div>
diff --git a/panikweb_templates/templates/combo/topik_menu_item.html b/panikweb_templates/templates/combo/topik_menu_item.html
new file mode 100644 (file)
index 0000000..475af68
--- /dev/null
@@ -0,0 +1,24 @@
+{% load combo paniktags thumbnail %}
+<li class="item">
+  <div class="topik inline cf">
+    <div class="logo">
+      {% with page|image_file as logo %}
+        {% if logo %}
+          {% thumbnail logo "60x60" crop="50% 25%" as im %}
+          <img width="60" height="60" src="{{im.url}}"/>
+          {% endthumbnail %}
+        {% else %}
+          <img src="/static/img/sound.png" width="60" height="60">
+        {% endif %}
+      {% endwith %}
+    </div>
+    <div class="content">
+      <div class="title">
+        <h5 class="title"><a href="{{page.get_online_url}}">{{page.title}}</a></h5>
+      </div>
+      <div class="smooth metas">
+        <span class="categories">{{page.title}}</span>
+      </div>
+    </div>
+  </div>
+</li>