| 1 | {% macro separator(label, align='center') %} |
| 2 | {# display a bloc separator |
| 3 | @param label(unicode): label to show |
| 4 | @param align(unicode): one of "left", "center", "right" |
| 5 | #} |
| 6 | <div class="block_separator"> |
| 7 | {% if align in ('center', 'right') %} |
| 8 | <div class="block_separator__line"></div> |
| 9 | {% endif %} |
| 10 | <div class="block_separator__label"> |
| 11 | {{label}} |
| 12 | </div> |
| 13 | {% if align in ('center', 'left') %} |
| 14 | <div class="block_separator__line"></div> |
| 15 | {% endif %} |
| 16 | </div> |
| 17 | {% endmacro %} |
| 18 | |
| 19 | {% macro icon_item(icon_name, label, url, class="", delete_icon=false, data=none) %} |
| 20 | <div class="column is-2-desktop is-4-touch item" {% if data %}data-item='{{data|tojson}}'{% endif %}> |
| 21 | <div class="card {{class}}"> |
| 22 | <a href="{{url}}" class=""> |
| 23 | <div class="card-image has-text-centered has-text-dark"> |
| 24 | {{ icon(icon_name, cls='image is-64x64 is-inline-block') }} |
| 25 | {% if delete_icon %} |
| 26 | <button class="delete action_delete is-small is-top-right"></button> |
| 27 | {% endif %} |
| 28 | </div> |
| 29 | <div class='card-content has-text-centered has-text-shortenable is-paddingless'> |
| 30 | <span>{{label}}</span> |
| 31 | </div> |
| 32 | </a> |
| 33 | </div> |
| 34 | </div> |
| 35 | {% endmacro %} |
| 36 | |
| 37 | {% macro disco_icon_grid(disco_entities, default_icon_name) %} |
| 38 | {# display discovered entities in a grid |
| 39 | @param disco_entities: entities which mush have a name and url key or attribute |
| 40 | @param icon_name: name of a defined icon |
| 41 | #} |
| 42 | <div class="columns"> |
| 43 | {% for disco_entity in disco_entities %} |
| 44 | {{ icon_item(disco_entity.icon_name or default_icon_name, disco_entity.name, disco_entity.url) }} |
| 45 | {% endfor %} |
| 46 | </div> |
| 47 | {% endmacro %} |
| 48 | |
| 49 | {% macro interests_grid(interests, default_icon_name, delete_icon=true) %} |
| 50 | {# display list of interests |
| 51 | |
| 52 | Can be called, in which call caller is called with 2 arguments: |
| 53 | - part: par to fill, can be "header-title" or "content" |
| 54 | - interest: current interest |
| 55 | @param interests: list of interests |
| 56 | @param default_icon_name: name of a defined icon to use when no thumb_url is available |
| 57 | @param delete_icon: unset to remove the icon |
| 58 | #} |
| 59 | <div class="columns is-multiline"> |
| 60 | {% for interest in interests %} |
| 61 | <div class="column is-4 item" data-item='{{interest|tojson}}'> |
| 62 | <div class="card"> |
| 63 | <div class="card-header"> |
| 64 | <div class="card-header-title"> |
| 65 | {% if caller is defined %} |
| 66 | {{ caller("header-title", interest) }} |
| 67 | {% endif %} |
| 68 | </div> |
| 69 | {% if delete_icon %} |
| 70 | <div class="card-header-icon"><button class="delete action_delete"></button></div> |
| 71 | {% endif %} |
| 72 | </div> |
| 73 | <div class="card-image is-photo-thumbnail-container is-flex has-items-centered has-background-light"> |
| 74 | <a href="{{interest.url}}"> |
| 75 | {% if interest.thumb_url %} |
| 76 | <img class="is-photo-thumbnail" src="{{interest.thumb_url}}"> |
| 77 | {% else %} |
| 78 | <div class="is-photo-thumbnail"> |
| 79 | {{ icon(default_icon_name, "image is-128x128 has-text-dark") }} |
| 80 | </div> |
| 81 | {% endif %} |
| 82 | </a> |
| 83 | </div> |
| 84 | <div class="card-content has-text-centered x-is-hoverable"> |
| 85 | {% if caller is defined %} |
| 86 | {{ caller("content", interest) }} |
| 87 | {% else %} |
| 88 | <a href="{{interest.url}}"> |
| 89 | <span><em>{{ interest.name|default(_("unnamed")) }}</em></span> |
| 90 | </a> |
| 91 | {% endif %} |
| 92 | </div> |
| 93 | </div> |
| 94 | </div> |
| 95 | {% endfor %} |
| 96 | </div> |
| 97 | {% endmacro %} |