Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add DataTable to the leaderboard table #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lets_quiz/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ <h6 class="mt-2"><a href="{% url 'quiz:play' %}" class="text-white">Let's play</
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/smooth-scroll/12.1.5/js/smooth-scroll.min.js" integrity="sha256-MMt0/21G3z0Zg4ET1kI3HC9npItDowkitRDVr0FhCxA=" crossorigin="anonymous"></script>

<!-- <script src="{% static 'js/main.js' %}"></script>
{% block js %}{% endblock js %} -->
<!-- <script src="{% static 'js/main.js' %}"></script> -->
{% block js %}{% endblock js %}
</body>
</html>
</html>
24 changes: 22 additions & 2 deletions lets_quiz/templates/quiz/leaderboard.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{% extends 'base.html' %}
{% block title %} Let's Quiz | Leaderboard {% endblock title %}

{% block css %}
{# css for datatables #}
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css">

{% endblock %}

{% block content %}
<div class="container">
<h1 class="text-center my-4"><span class="badge badge-info"><i class="fa fa-trophy" aria-hidden="true"></i> TOP {{ total_count }} PLAYERS <i class="fa fa-trophy" aria-hidden="true"></i></span></h1>
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered" id="leaderboard_table">
<thead>
<tr>
<th>Position</th>
Expand All @@ -22,4 +29,17 @@ <h1 class="text-center my-4"><span class="badge badge-info"><i class="fa fa-trop
</tbody>
</table>
</div>
{% endblock content %}
{% endblock content %}

{% block js %}
{# script for datatables #}
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>

<script type="text/javascript">
// add dataTable to leaderboard table
$(document).ready( function () {
$('#leaderboard_table').DataTable();
});

</script>
{% endblock %}