From 5e0f4aee52c390bebf9aed0f595acbdecb0dac81 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr>
Date: Tue, 17 Jul 2018 18:01:06 +0200
Subject: [PATCH] add "jump to page" control in pagination

closes #69


Former-commit-id: 5ffdd28c0a3252f69c12f60dcb5a7c9f2a0969fe
---
 ippisite/ippidb/templates/compound_list.html | 22 +++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/ippisite/ippidb/templates/compound_list.html b/ippisite/ippidb/templates/compound_list.html
index 103350e6..7d391871 100644
--- a/ippisite/ippidb/templates/compound_list.html
+++ b/ippisite/ippidb/templates/compound_list.html
@@ -122,10 +122,13 @@
 </div>
 
 <nav>
-  <ul class="pagination justify-content-end">
+  <ul class="pagination pagination-sm justify-content-end col-12">
     {% if compounds.has_previous %}
     <li class="page-item">
-     <a class="page-link" href="?{% url_replace request 'page' compounds.previous_page_number  %}" tabindex="-1">Previous</a>
+      <a class="page-link" href="?{% url_replace request 'page' compounds.previous_page_number  %}" aria-label="Previous">
+        <span aria-hidden="true">&laquo;</span>
+        <span class="sr-only">Previous</span>
+      </a>
     </li>
     {% endif %}
 
@@ -135,9 +138,22 @@
 
     {% if compounds.has_next %}
     <li class="page-item">
-     <a class="page-link" href="?{% url_replace request 'page' compounds.next_page_number  %}" tabindex="-1">Next</a>
+      <a class="page-link" href="?{% url_replace request 'page' compounds.next_page_number  %}" aria-label="Next">
+        <span aria-hidden="true">&raquo;</span>
+        <span class="sr-only">Next</span>
+      </a>
     </li>
     {% endif %}
+
+    <li class="page-item ml-3">
+      <div class="input-group input-group-sm">
+        <input id="pageNumber" type="number" min="1" max="{{compounds.paginator.num_pages}}" step="1" placeholder="page #" style="width: 4em;" aria-label="Page number">
+        <div class="input-group-append">
+          <button class="btn btn-outline-primary" type="button" onclick="modifyUrl('page',$('#pageNumber').val())">Go</button>
+        </div>
+      </div>
+    </li>
+
   </ul>
 </nav>
 
-- 
GitLab