<%inherit file="/template.html" />
<%namespace name="components" file="/components.html"/>
<%namespace name="badge_tiles" file="/badge/tiles.html"/>
<%def name="title()">${_("Edit Badges for %s") % c.page_user.name}</%def>

<%def name="breadcrumbs()">
    ${h.user.breadcrumbs(c.page_user)|n} &raquo; ${_("Edit Badges")}
</%def>


<%block name="headline">
<h1>${c.page_user.user_name}</h1>
</%block>

<%block name="main_content">
<h2>${_('Badges for %s') % c.page_user.user_name}</h2>
<form name="settings" class="inplace" method="POST"
    action="${h.entity_url(c.page_user, instance=c.instance, member='badges')}">

    ${h.field_token()|n}

    %if c.badges:
    <table>
        <thead>
            <th></th>
            <th>${_("Global badges")}</th>
        </thead>
        <tbody>
            %for badge in c.badges:
            <tr>
                <td>
                    <input type="checkbox" value="${badge.id}"
                           name="badge" />
                </td>
                <td><b>${badge.title}</b> ${_('Example:')} ${badge_tiles.badge(badge)}</td>
            </tr>
            %endfor
        </tbody>
    </table>
    %endif

    %if c.instance_badges:
        <table>
            <thead>
                <th></th>
                <th>${_("Badges in instance")} ${c.instance.label}</th>
            </thead>
            <tbody>
                %for badge in c.instance_badges:
                <tr>
                    <td>
                        <input type="checkbox" value="${badge.id}"
                               name="badge" />
                    </td>
                    <td><b>${badge.title}</b> ${_('Example:')} ${badge_tiles.badge(badge)}</td>
                </tr>
                %endfor
            </tbody>
        </table>
    %endif

    <div style="clear:both;"></div>

    ${components.savebox(h.base_url("/user/%s" % c.page_user.user_name))}

</form>
</%block>
