comparison sat_templates/templates/bulma/components/block.html @ 325:8c779fb46384

bulma (components/block): interests_grid is more customisable: - new `delete_icon` argument can be set to `false` if delete icon is not desired - the macro can now be called, the caller then get 2 arguments: part to customise and current interest. Part to customise can be: * `header-title`: markup to put in the title * `content`: car content (replaces the default `interest.name`)
author Goffi <goffi@goffi.org>
date Sat, 01 May 2021 18:44:47 +0200
parents 2a697b1376f1
children dc83f45625b3
comparison
equal deleted inserted replaced
324:580fa5482e88 325:8c779fb46384
44 {{ icon_item(disco_entity.icon_name or default_icon_name, disco_entity.name, disco_entity.url) }} 44 {{ icon_item(disco_entity.icon_name or default_icon_name, disco_entity.name, disco_entity.url) }}
45 {% endfor %} 45 {% endfor %}
46 </div> 46 </div>
47 {% endmacro %} 47 {% endmacro %}
48 48
49 {% macro interests_grid(interests, default_icon_name) %} 49 {% macro interests_grid(interests, default_icon_name, delete_icon=true) %}
50 {# display list of interests 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
51 @param interests: list of interests 55 @param interests: list of interests
52 @param default_icon_name: name of a defined icon to use when no thumb_url is available 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
53 #} 58 #}
54 <div class="columns is-multiline"> 59 <div class="columns is-multiline">
55 {% for interest in interests %} 60 {% for interest in interests %}
56 <div class="column is-4 item" data-item='{{interest|tojson}}'> 61 <div class="column is-4 item" data-item='{{interest|tojson}}'>
57 <div class="card"> 62 <div class="card">
58 <div class="card-header"> 63 <div class="card-header">
59 <div class="card-header-title"></div> 64 <div class="card-header-title">
60 <div class="card-header-icon"><button class="delete action_delete"></button></div> 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 %}
61 </div> 72 </div>
62 <div class="card-image is-photo-thumbnail-container is-flex has-items-centered has-background-light"> 73 <div class="card-image is-photo-thumbnail-container is-flex has-items-centered has-background-light">
63 <a href="{{interest.url}}"> 74 <a href="{{interest.url}}">
64 {% if interest.thumb_url %} 75 {% if interest.thumb_url %}
65 <img class="is-photo-thumbnail" src="{{interest.thumb_url}}"> 76 <img class="is-photo-thumbnail" src="{{interest.thumb_url}}">
69 </div> 80 </div>
70 {% endif %} 81 {% endif %}
71 </a> 82 </a>
72 </div> 83 </div>
73 <div class="card-content has-text-centered x-is-hoverable"> 84 <div class="card-content has-text-centered x-is-hoverable">
74 <a href="{{interest.url}}"> 85 {% if caller is defined %}
75 <span><em>{{ interest.name|default(_("unnamed")) }}</em></span> 86 {{ caller("content", interest) }}
76 </a> 87 {% else %}
88 <a href="{{interest.url}}">
89 <span><em>{{ interest.name|default(_("unnamed")) }}</em></span>
90 </a>
91 {% endif %}
77 </div> 92 </div>
78 </div> 93 </div>
79 </div> 94 </div>
80 {% endfor %} 95 {% endfor %}
81 </div> 96 </div>