<%inherit file="/template.html" />
<%namespace name="components" file="/components.html"/>
<%def name="title()">${_("Delegate: %s") % c.scope.title}</%def>

<%def name="breadcrumbs()">
    ${h.delegateable.breadcrumbs(c.scope)|n} &raquo; ${_("Delegation")}
</%def>

<%block name="headline">
<h1>${_("Delegate: %s") % c.scope.title}</h1>
</%block>

<%block name="main_content">
<form name="create_delegation" class="inplace" method="POST" action="${h.base_url('/delegation')}">
    ${h.field_token()|n}
    <input name="scope" value="${c.scope.id}" type="hidden" />

    <div class="sidebar">
        <div class="infobox">
            ${_("These people might be a good match for your delegation. Either select " +
                "one of the listed delegates, or enter another user name.")}
        </div>
    </div>
    <div class="mainbar">

        <%
        scope_agents = lib.recommend(c.scope, c.user)
        %>
        <table class="table" width="100%">
        %if len(scope_agents):

            %for user in scope_agents:
            <tr>
                <td width="1%">
                    <input type="radio" name="agent" value="${user.user_name}" />
                </td>
                <td>
                    ${tiles.user.row(user)}
                </td>
            </tr>
            %endfor

        %endif
            <tr>
                <td width="1%">
                    <input type="radio" value="" name="agent" checked="checked" />
                </td>
                <td>
                    <div class="tile">
                        <div class="logo">
                            <img src="/images/user_32.png" />
                        </div>
                        <div class="base">
                        <% h.need.autocomplete %>
                        <input name="agent" class="userCompleted" style="padding: 0.5em; width: 85%;" />
                        <div class="meta">
                            ${_("Start typing, you will receive suggestions to find the user.")}
                        </div>
                        </div>
                    </div>
                </td>
            </tr>
        </table>

        <input name="replay" value="1" checked="checked" type="checkbox" />
        ${_("Include decisions made before now.")}
    </div>
    ${components.savebox(h.base_url('/d/%s' % c.scope.id))}

</form>
</%block>
