#510 Add the pagination links at the bottom of the repo list as well
Merged 9 years ago by pingou. Opened 9 years ago by pingou.

@@ -32,6 +32,35 @@ 

  {%- endmacro %}

  

  

+ {% macro pagination_link(pagetitle, page, total) -%}

+ <aside>

+     <table>

+         <tr>

+             <td>

+             {% if page > 1%}

+                 <a href="{{ url_for('index') }}?{{ pagetitle }}={{page - 1}}">

+                     &lt; Previous

+                 </a>

+             {% else %}

+                 &lt; Previous

+             {% endif %}

+             </td>

+             <td>{{ page }} / {{ total }}</td>

+             <td>

+                 {% if page < total %}

+                 <a href="{{ url_for('index') }}?{{ pagetitle }}={{page + 1}}">

+                     Next &gt;

+                 </a>

+                 {% else %}

+                 Next >

+                 {% endif %}

+             </td>

+         </tr>

+     </table>

+ </aside>

+ {%- endmacro %}

+ 

+ 

  {% macro render_repos(

          list, total, pagetitle, page, title, count, id, username=None, hide=True) %}

      <section class="project_list" id="{{ id }}"{%
@@ -42,35 +71,14 @@ 

              <h{{ title_lvl }}>{{ title }} ({{ count }})</h{{ title_lvl }}>

          </header>

          {% if total and total > 1 %}

-         <aside>

-             <table>

-                 <tr>

-                     <td>

-                     {% if page > 1%}

-                         <a href="{{ url_for('index') }}?{{ pagetitle }}={{page - 1}}">

-                             &lt; Previous

-                         </a>

-                     {% else %}

-                         &lt; Previous

-                     {% endif %}

-                     </td>

-                     <td>{{ page }} / {{ total }}</td>

-                     <td>

-                         {% if page < total %}

-                         <a href="{{ url_for('index') }}?{{ pagetitle }}={{page + 1}}">

-                             Next &gt;

-                         </a>

-                         {% else %}

-                         Next >

-                         {% endif %}

-                     </td>

-                 </tr>

-             </table>

-         </aside>

+         {{ pagination_link(pagetitle, page, total) }}

          {% endif %}

          <div>

              {{ render_row(list) }}

          </div>

+         {% if total and total > 1 %}

+         {{ pagination_link(patetitle, page, total) }}

+         {% endif %}

      </section>

  {% endmacro %}

  

no initial comment

Would be nice to have this as a reused macro, but since that's harder to read, +1.

Metadata