{% macro userItem(user, id=None, link=None, small=False) -%}
{% if link != None %}
<a href="{{link}}" class="user-item {% if small %}small{% endif %}" id='{{id}}'>
{% else %}
<div href="{{link}}" class="user-item {% if small %}small{% endif %}" id='{{id}}'>
{% endif %}
    <img src='{{ dataurl(user.icon) }}' class='icon' />
    <div class='detail'>
        <div class='name'>{{ user.name }}</div>
        <div class='screen-name'>{{ user.screen_name }}</div>
    </div>
{% if link != None %}
</a>
{% else %}
</div>
{% endif %}
{%- endmacro %}
{% macro groupItem(group, id=None, link=None, tree=False, small=False) -%}
<div class="group-item {% if small %}small{% endif %}" id='{{id}}'>
    <div class='branch'></div>
    <a {% if link != None %}href="{{link}}"{% endif %} class='profile'>
        <img src='{{ dataurl(group.icon) }}' class='icon' />
        <div class='detail'>
            <div class='name'>{{ group.name }}</div>
            <div class='screen-name'>{{ group.screen_name }}</div>
        </div>
    </a>
    {% if tree and group.groups.length != 0 %}
    <div class='children'>
        {{ tree(group.groups) }}
    </div>
    {% endif %}
</div>
{%- endmacro %}
{% macro appItem(app, id=None, link=None, small=False) -%}
{% if link != None %}
<a href="{{link}}" class="app-item {% if small %}small{% endif %}" id='{{id}}'>
{% else %}
<div href="{{link}}" class="app-item {% if small %}small{% endif %}" id='{{id}}'>
{% endif %}
    <img src='{{ dataurl(app.icon) }}' class='icon' />
    <div class='detail'>
        <div class='name'>{{ app.name }}</div>
        <div class='screen-name'>{{ app.screen_name }}</div>
        <p class='description'>{{ app.description }}</p>
    </div>
{% if link != None %}
</a>
{% else %}
</div>
{% endif %}
{%- endmacro %}
