Commits

Benoît Allard committed e1d897c

web: Bootstrapize the pagination

Comments (0)

Files changed (1)

web/templates/macros.j2

 {# -*-HTML-*- #}
 
 {% macro render_pagination(pagination) %}
-  <center><div class=pagination>
-  {% if pagination.has_prev %}
-    <a href="{{ url_for_other_page(pagination.page - 1)
-       }}">&laquo; Previous</a>
-  {% endif %}
-  {%- for page in pagination.iter_pages() %}
+<div class="pagination pagination-centered">
+  <ul>
+    <li class="{{ 'disabled' if not pagination.has_prev }}">
+      <a href="{{ url_for_other_page(pagination.page - 1) }}">
+	&laquo;
+      </a>
+    </li>
+    {%- for page in pagination.iter_pages() %}
     {% if page %}
-      {% if page != pagination.page %}
-        <a href="{{ url_for_other_page(page) }}">{{ page }}</a>
-      {% else %}
-        <strong>{{ page }}</strong>
-      {% endif %}
+    <li class="{{ 'active' if page == pagination.page }}">
+      <a href="{{ url_for_other_page(page) }}">{{ page }}</a>
+    </li>
     {% else %}
-      <span class=ellipsis>&hellip;</span>
+    <li><span class=ellipsis>&hellip;</span></li>
     {% endif %}
-  {%- endfor %}
-  {% if pagination.has_next %}
-    <a href="{{ url_for_other_page(pagination.page + 1) }}">Next &raquo;</a>
-  {% endif %}
-  </div></center>
+    {%- endfor %}
+    <li class="{{ 'disabled' if not pagination.has_next }}">
+      <a href="{{ url_for_other_page(pagination.page - 1) }}">
+	&raquo;
+      </a>
+    </li>
+  </ul>
+</div>
 {% endmacro %}
 
 {% macro render_changesets_for_issue(issue) %}