<%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}</%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 badge in c.badges:
        <li>
            <label>
                <input type="checkbox" value="${badge.id}"
                       name="badge" />
                ${badge_tiles.badge(badge)}
            </label>
        </li>
        %endfor
    </ul>
    %else:
    <p>${_(u"No Badges")}</p>
    %endif

    ${components.savebox(h.base_url("/instance/%s" % c.page_instance.key))}
</form>

</%block>
