diff sat_templates/templates/default/components/block.html @ 196:03c8fd941c0c

event, photo, components: moved interests grid in a macro (in components/block)
author Goffi <goffi@goffi.org>
date Fri, 03 May 2019 23:56:11 +0200
parents 4a03d0a6839b
children
line wrap: on
line diff
--- a/sat_templates/templates/default/components/block.html	Fri May 03 20:55:49 2019 +0200
+++ b/sat_templates/templates/default/components/block.html	Fri May 03 23:56:11 2019 +0200
@@ -32,3 +32,24 @@
         {% endfor %}
     </ul>
 {% endmacro %}
+
+{% macro interests_grid(interests, default_icon_name) %}
+{# display list of interests
+    @param interests: list of interests
+    @param default_icon_name: name of a defined icon to use when no thumb_url is available
+#}
+    <ul class="grid grid--center">
+        {% for interest in interests %}
+            <li class='grid__item grid__item--medium grid__item--selectable'>
+                <a href="{{interest.url}}">
+                    {% if interest.thumb_url %}
+                        <img class="img--small" src="{{interest.thumb_url}}">
+                    {% else %}
+                        <div>{{ icon(default_icon_name, cls='icon--medium') }}</div>
+                    {% endif %}
+                    <span><em>{{ interest.name|default(_("unnamed")) }}</em></span>
+                </a>
+            </li>
+        {% endfor %}
+    </ul>
+{% endmacro %}