<%namespace name="components" file="/components.html"/>

<%def name="row(tile, user)">
    <li class="content_box vcard">
        <h3>
            <a class="link fn nickname" href="${h.entity_url(user, instance=c.instance)}">${user.name}</a>
            ${tiles.badge.badges(user.get_badges(c.instance))}
        </h3>
        <div class="meta">
            <%
            mem = user.instance_membership(c.instance)
            %>
            %if mem:
                <span class="role">
                    ${tile.translated_instance_role_names()}
                    </span> ·
                ${_("joined %s") % h.datetime_tag(mem.create_time)|n}
            %else:
                ${_("signed up %s") % h.datetime_tag(user.create_time)|n}
            %endif
        </div>
    </li>
</%def>

<%def name="header(tile, user, active, show_delete_user_button=False)">

    <div class="top_actions title vcard">
        %if lib.auth.welcome.can_welcome():
        <form method="post" class="inline-form" action="${h.entity_url(user, instance=c.instance, member='generate_welcome_link')}">
        ${h.field_token()|n}
        <input type="submit" class="button generate_welcome_link" value="${_('Generate welcome link')}" />
        </form>
        %endif
    </div>


<%doc> FIXME: move to new design?
    <div class="panel ${active}">
        <ul class="menu">
            <li><a href="${h.entity_url(user)}" rel="profile url" class="activity">${_("Activity")}</a></li>
            %if c.instance:
                %if c.instance.allow_adopt:
                    <li><a href="${h.entity_url(user, member='votes')}" class="votes">${_("Votes")}</a></li>
                %endif
                %if c.instance.allow_delegate:
                    <li><a href="${h.entity_url(user, member='delegations')}"
                        class="delegations">${_("Delegations")}
                        (${len(user.current_agencies())})</a></li>
                %endif
                <li><a href="${h.entity_url(user, member='proposals')}" class="proposals">${_("Proposals")}
                    (${tile.num_proposals})</a></li>

                <li><a href="${h.entity_url(user, member='watchlist')}" class="watchlist">${_("Watchlist")}
                    (${user.num_watches})</a></li>
            %endif
            %if g.single_instance is None:
                <li><a href="${h.entity_url(user, member='instances')}" class="instances">${_("Instances")}
                    (${tile.num_instances})</a></li>
            %endif
        </ul>
    </div>
</%doc>

</%def>


<%def name="captchasdotnet(cap, random)">
    <div>
        ${cap.image(random)|n}
    </div>
    <a href="${cap.audio_url(random)|n}">${_(u'Phonetic spelling')}</a>
    <input type="hidden" name="captchasdotnet_random" value="${random|n}" />
    <div class="input_wrapper">
        <input type="text" name="captchasdotnet_captcha" />
    </div>
</%def>
