<%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_instance.title|n}</%def>

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

<%block name="main_content">

## NOTE: Don't use entity_url in href due to same-origin-policy issue (#621)
<form name="settings" class="inplace" method="POST"
    action="${'/instance/%s/update_badges' % c.page_instance.key}">

    ${h.field_token()|n}
    <h3>${_(u"Badges")}</h3>

    %if c.badges:
    <ul class="nobullet">
        %for b in c.badges:
        <li>
            <label>
                <input type="checkbox" value="${b.id}"
                       name="badge" />
                ${badge_tiles.badge(b, force_visible=True)}
                %if not b.visible:
                <em>(${_('invisible')})</em>
                %endif
            </label>
        </li>
        %endfor
    </ul>
    %else:
    <p>${_(u"No badges")}</p>
    %endif

    ${components.savebox(h.entity_url(c.page_instance))}
</form>

</%block>
