<table class="table">
    %if c.default_user_ip_map:
        %for ip in c.default_user_ip_map:
          <tr>
            <td><div class="ip">${ip.ip_addr}</div></td>
            <td><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
            <td>${h.HTML(_('Inherited from %s')) % h.link_to('*default*',h.url('admin_permissions_ips'))}</td>
          </tr>
        %endfor
    %endif

    %if c.user_ip_map:
        %for ip in c.user_ip_map:
          <tr>
            <td><div class="ip">${ip.ip_addr}</div></td>
            <td><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
            <td>
                ${h.form(url('edit_user_ips_delete', id=c.user.user_id))}
                    ${h.hidden('del_ip_id',ip.ip_id)}
                    <i class="icon-trashcan"></i>
                    ${h.submit('remove_',_('Delete'),id="remove_ip_%s" % ip.ip_id,
                        class_="btn btn-default btn-xs", onclick="return confirm('"+_('Confirm to delete this IP address: %s') % ip.ip_addr+"');")}
                ${h.end_form()}
            </td>
          </tr>
        %endfor
    %endif
    %if not c.default_user_ip_map and not c.user_ip_map:
        <tr><td><div class="ip">${_('All IP addresses are allowed.')}</div></td></tr>
    %endif
</table>

<div>
    ${h.form(url('edit_user_ips_update', id=c.user.user_id))}
    <div class="form">
            <div class="form-group">
                <label class="control-label" for="new_ip">${_('New IP address')}:</label>
                <div>
                    ${h.text('new_ip', class_='form-control')}
                </div>
            </div>
            <div class="form-group">
                <div class="buttons">
                    ${h.submit('save',_('Add'),class_="btn btn-default")}
                    ${h.reset('reset',_('Reset'),class_="btn btn-default")}
                </div>
            </div>
    </div>
    ${h.end_form()}
</div>
