diff --git a/forum/templates/forum/forum_discussion_detail.html b/forum/templates/forum/forum_discussion_detail.html index b2517c25c8e1c183790ee27c7a6d9249565ece51..e0d40e714d21c8bb957ba9fe9730ca820f296aa7 100644 --- a/forum/templates/forum/forum_discussion_detail.html +++ b/forum/templates/forum/forum_discussion_detail.html @@ -132,37 +132,7 @@ </div> </div> </div> -<nav aria-label="Discussion Detail Pagination"> - <ul class="pagination justify-content-center"> - {% if page_obj.has_previous %} - <li class="page-item"> - <a class="page-link" href="?page={{ page_obj.previous_page_number }}" tabindex="-1">Previous</a> - </li> - {% else %} - <li class="page-item disabled"> - <a class="page-link" href="" tabindex="-1">Previous</a> - </li> - {% endif %} - - {% for page in pages %} - {% if page == "..." %} - <li class="page-item disabled"><a class="page-link" href="">{{ page }}</a></li> - {% else %} - <li class="page-item"><a class="page-link" href="?page={{ page }}">{{ page }}</a></li> - {% endif %} - {% endfor %} - - {% if page_obj.has_next %} - <li class="page-item"> - <a class="page-link" href="?page={{ page_obj.next_page_number }}" tabindex="-1">Next</a> - </li> - {% else %} - <li class="page-item disabled"> - <a class="page-link" href="" tabindex="-1">Next</a> - </li> - {% endif %} - </ul> -</nav> +{% include 'forum/forum_pagination.html' %} </div> {% endblock content %} {% block extra_scripts %} diff --git a/forum/templates/forum/forum_home.html b/forum/templates/forum/forum_home.html index 4c2ae90ea92f76b7d224c9db0af2a485bc46b511..ec7af7614610f9f89b84952b9c61be139c2f7d0a 100644 --- a/forum/templates/forum/forum_home.html +++ b/forum/templates/forum/forum_home.html @@ -31,36 +31,6 @@ {% empty %} <h4 id="no-discussion">There is no discussion at the moment</h4> {% endfor %} - <nav aria-label="Page navigation example"> - <ul class="pagination justify-content-center"> - {% if page_obj.has_previous %} - <li class="page-item"> - <a class="page-link" href="?page={{ page_obj.previous_page_number }}" tabindex="-1">Previous</a> - </li> - {% else %} - <li class="page-item disabled"> - <a class="page-link" href="" tabindex="-1">Previous</a> - </li> - {% endif %} - - {% for page in pages %} - {% if page == "..." %} - <li class="page-item disabled"><a class="page-link" href="">{{ page }}</a></li> - {% else %} - <li class="page-item"><a class="page-link" href="?page={{ page }}">{{ page }}</a></li> - {% endif %} - {% endfor %} - - {% if page_obj.has_next %} - <li class="page-item"> - <a class="page-link" href="?page={{ page_obj.next_page_number }}" tabindex="-1">Next</a> - </li> - {% else %} - <li class="page-item disabled"> - <a class="page-link" href="" tabindex="-1">Next</a> - </li> - {% endif %} - </ul> - </nav> + {% include 'forum/forum_pagination.html' %} </div> {% endblock content %} \ No newline at end of file diff --git a/forum/templates/forum/forum_pagination.html b/forum/templates/forum/forum_pagination.html new file mode 100644 index 0000000000000000000000000000000000000000..04287c528517a174f18b185c265710c6874da660 --- /dev/null +++ b/forum/templates/forum/forum_pagination.html @@ -0,0 +1,31 @@ +<nav aria-label="Page navigation example"> + <ul class="pagination justify-content-center"> + {% if page_obj.has_previous %} + <li class="page-item"> + <a class="page-link" href="?page={{ page_obj.previous_page_number }}" tabindex="-1">Previous</a> + </li> + {% else %} + <li class="page-item disabled"> + <a class="page-link" href="" tabindex="-1">Previous</a> + </li> + {% endif %} + + {% for page in pages %} + {% if page == "..." %} + <li class="page-item disabled"><a class="page-link" href="">{{ page }}</a></li> + {% else %} + <li class="page-item"><a class="page-link" href="?page={{ page }}">{{ page }}</a></li> + {% endif %} + {% endfor %} + + {% if page_obj.has_next %} + <li class="page-item"> + <a class="page-link" href="?page={{ page_obj.next_page_number }}" tabindex="-1">Next</a> + </li> + {% else %} + <li class="page-item disabled"> + <a class="page-link" href="" tabindex="-1">Next</a> + </li> + {% endif %} + </ul> +</nav> \ No newline at end of file