[%~ BLOCK edit_status ~%]
    [%~ IF edit.status == 1 ~%]
        [%- " open" -%]
    [%~ ELSIF edit.status == 2 ~%]
        [%- " applied" -%]
    [%~ ELSIF edit.status == 3 ~%]
        [%- " failed" -%]
    [%~ ELSIF edit.status == 8 %]
        [%- " cancelling" -%]
    [%~ ELSIF edit.status == 9 ~%]
        [%- " cancelled" -%]
    [%~ ELSE ~%]
        [%- " edit-error" -%]
    [%~ END ~%]
[%~ END ~%]

[% INCLUDE 'edit/list_header.tt' %]

<div class="search-toggle c">
    <p>
        <strong>
          [%# guess_search is set here when we don't necessarily know the total
              number of entries on the first page (and usually a few after), due
              to there being more than the SQL LIMIT to start.

              We only use the 'at least' wording when guess_search is on in the
              case where it's truly unclear. That is, where the total number is
              the exact number that would have been found in any case with that
              many edits or more. That is: when there are exactly edit_count_limit
              edits more than the sum of all previous pages.

              In the case where this is not true, we unset guess_search so the
              paginator also knows this is an exact number of pages. -%]
          [% IF guess_search &&
                pager.total_entries == pager.entries_per_page * (pager.current_page - 1) + edit_count_limit %]
            [%- ln('Found at least {n} edit', 'Found at least {n} edits' ,
                    pager.total_entries,
                    { n => add_commas(pager.total_entries) }) -%]
          [% ELSE %]
            [%- ln('Found {n} edit', 'Found {n} edits' ,
                    pager.total_entries,
                    { n => add_commas(pager.total_entries) }) -%]
            [% SET guess_search = 0 %]
          [% END %]
        </strong>
    </p>
</div>

[% IF edits.size %]
    <div id="edits">
    [% WRAPPER 'components/with-pager.tt' search=0;
    # We always want search != 1 when calling the paginator from this template %]
        <form action="[% c.uri_for('/edit/enter_votes') %]" method="post">
            [%~ FOREACH edit=edits ~%]
                <div class="edit-list">
                    [%~ INCLUDE 'edit/edit_header.tt' summary=1 -%]

                    <input type="hidden" value="[% edit.id %]" name="enter-vote.vote.[% loop.index %].edit_id" />

                    <div class="edit-actions c[%- PROCESS edit_status -%]">
                        [%- INCLUDE 'edit/info.tt' summary=1 -%]
                    </div>

                    <div class="edit-details">
                        [% IF edit.data.defined %]
                           [%-INCLUDE "edit/details/${edit.edit_template}.tt" %]
                        [% ELSE %]
                           <p>[% l('An error occured while loading this edit') %]</p>
                        [% END %]
                    </div>

                    [% INCLUDE 'edit/notes.tt' verbose='not-verbose' hide=1 rows=1 index=loop.index %]

                    <div class="seperator">
                    </div>
                </div>
            [%- END -%]

            <input type="hidden" name="url" value="[% c.req.uri %]" />
            <div class="row no-label" style="text-align: right">
                [% form_submit(l('Submit votes &amp; edit notes')) %]
            </div>
        </form>
    [% END %]
    </div>
[% ELSE %]
    [% IF search %]
        <p>[% l('No edits were found matching your query. Please {search|try again}.',
               { search => c.uri_for_action('/edit/search') }) %]</p>
    [% END %]
[% END %]

<script type="text/javascript">//<![CDATA[
  $(".edit-list").each(function () {
      MB.Control.EditSummary(this);
  });

  [% IF c.user.is_auto_editor %]
    MB.Control.EditList("#edits");
  [% END %]
//]]></script>
