<!-- Navigation -->
<tal:batchnavigation define="batch view/batch|nothing"
    condition="batch"
    metal:define-macro="navigation">

  <div class="pagination listingBar"
    i18n:domain="plone"
    tal:condition="batch/multiple_pages">

    <tal:comment replace="nothing">
      <!-- Link to previous page -->
    </tal:comment>
    <a class="previous"
        tal:condition="batch/has_previous"
        tal:attributes="href python:view.make_link(batch.previouspage)">
      &laquo;
      <span i18n:translate="batch_previous_x_items" tal:omit-tag="">
        Previous
        <span i18n:name="number" tal:omit-tag="" tal:content="batch/pagesize">n</span>
        items
      </span>
    </a>

    <tal:comment replace="nothing">
      <!-- Link to next page -->
    </tal:comment>
    <a class="next"
        tal:condition="batch/has_next"
        tal:attributes="href python:view.make_link(batch.nextpage)">
      <span i18n:translate="batch_next_x_items" tal:omit-tag="">
        Next
        <span i18n:name="number" tal:omit-tag="" tal:content="batch/next_item_count">n</span>
        items
      </span>
      &raquo;
    </a>

    <tal:comment replace="nothing">
      <!-- First page -->
    </tal:comment>
    <a class="first"
        tal:condition="batch/show_link_to_first"
        tal:attributes="href python:view.make_link(1)">1</a>

    <tal:comment replace="nothing">
      <!-- Ellipsis after first item -->
    </tal:comment>
    <span class="disabled"
        tal:condition="batch/second_page_not_in_navlist">
       ...
    </span>

    <tal:comment replace="nothing">
      <!-- Pagelist with links to previous pages for quick navigation -->
    </tal:comment>
    <a tal:repeat="pagenumber batch/previous_pages"
        tal:content="pagenumber"
        tal:attributes="href python:view.make_link(pagenumber)" />

    <tal:comment replace="nothing">
      <!-- Current page -->
    </tal:comment>
    <span class="current"
        tal:condition="batch/navlist"
        tal:content="batch/pagenumber" />

    <tal:comment replace="nothing">
      <!-- Pagelist with links to next pages for quick navigation -->
    </tal:comment>
    <a tal:repeat="pagenumber batch/next_pages"
        tal:content="pagenumber"
        tal:attributes="href python:view.make_link(pagenumber)" />

    <tal:comment replace="nothing">
      <!-- Ellipsis before last item -->
    </tal:comment>
    <span class="disabled"
        tal:condition="batch/before_last_page_not_in_navlist">
       ...
    </span>

    <tal:comment replace="nothing">
      <!-- Link to last -->
    </tal:comment>
    <a class="last"
        tal:condition="batch/show_link_to_last"
        tal:attributes="href python:view.make_link(batch.lastpage)"
        tal:content="batch/lastpage" />

  </div>

</tal:batchnavigation>
