view sat_templates/templates/bulma/components/block.html @ 234:b54526baef6b

(bulma) chat: fixed typo in classname
author Goffi <goffi@goffi.org>
date Tue, 19 May 2020 18:41:14 +0200
parents 0e69b5843c2f
children 10278ba367a2
line wrap: on
line source

{% macro separator(label, align='center') %}
{# display a bloc separator
    @param label(unicode): label to show
    @param align(unicode): one of "left", "center", "right"
#}
    <div class="block_separator">
        {% if align in ('center', 'right') %}
            <div class="block_separator__line"></div>
        {% endif %}
        <div class="block_separator__label">
            {{label}}
        </div>
        {% if align in ('center', 'left') %}
            <div class="block_separator__line"></div>
        {% endif %}
    </div>
{% endmacro %}

{% macro icon_item(icon_name, label, url, class="") %}
    <div class="column is-2-desktop is-4-touch">
        <div class="card {{class}}">
            <a href="{{url}}">
                <div class="card-image has-text-centered">
                    {{ icon(icon_name, cls='image is-64x64 is-inline-block') }}
                </div>
                <div class='card-content has-text-centered has-text-shortenable is-paddingless'>
                    <span>{{label}}</span>
                </div>
            </a>
        </div>
    </div>
{% endmacro %}

{% macro disco_icon_grid(disco_entities, icon_name) %}
{# display discovered entities in a grid
    @param disco_entities: entities which mush have a name and url key or attribute
    @param icon_name: name of a defined icon
#}
    <div class="columns">
        {% for disco_entity in disco_entities %}
            {{ icon_item(icon_name, disco_entity.name, disco_entity.url) }}
        {% endfor %}
    </div>
{% 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
#}
<div class="columns is-multiline">
    {% for interest in interests %}
        <div class="column is-4">
            <div class="card x-is-hoverable">
                <a href="{{interest.url}}">
                    <div class="card-image is-photo-thumbnail-container is-flex has-items-centered has-background-light">
                        {% if interest.thumb_url %}
                            <img class="is-photo-thumbnail" src="{{interest.thumb_url}}">
                        {% else %}
                            <div class="is-photo-thumbnail">
                                {{ icon(default_icon_name, "image is-128x128") }}
                            </div>
                        {% endif %}
                    </div>
                    <div class="card-content has-text-centered">
                        <span><em>{{ interest.name|default(_("unnamed")) }}</em></span>
                    </div>
                </a>
            </div>
        </div>
    {% endfor %}
</div>
{% endmacro %}