-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Edouard Bourque
committed
Apr 19, 2024
1 parent
1738199
commit c6514e7
Showing
7 changed files
with
110 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/dist/tabler-icons.min.css" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css"> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
<style> | ||
.custom-badge { | ||
|
@@ -43,16 +44,16 @@ <h1 class='fw-bold text-warning'>Clan ranking</h1> | |
{% else %} | ||
<p class='text-muted'>Updated {{ lastUpdatedMin }} minutes ago</p> | ||
{% endif %} | ||
<div class='d-flex justify-content-between'> | ||
<div class='d-flex justify-content-end'> | ||
<div class="btn-group mb-4 justify-content-center mx-3" role="group" aria-label="Basic example"> | ||
<button type="button" class="btn btn-primary pe-none">{{ clan.name }}</button> | ||
<a id='refreshButton' href="/clanrefresh/{{ clan.tag|slice:"1:" }}" class="btn btn-outline-primary" role="button"><i class="bi bi-arrow-clockwise" style='-webkit-text-stroke: 1px;'></i></a> | ||
</div> | ||
<div> | ||
<button type="button" class="btn btn-outline-primary mb-4" data-bs-toggle="modal" data-bs-target="#weeklyRanking"> | ||
Weekly ranking | ||
Historical ranking | ||
</button> | ||
</div> | ||
<div class="btn-group mb-4 justify-content-center" role="group" aria-label="Basic example"> | ||
<button type="button" class="btn btn-primary pe-none">{{ clan.name }}</button> | ||
<a id='refreshButton' href="/clanrefresh/{{ clan.tag|slice:"1:" }}" class="btn btn-outline-primary" role="button"><i class="bi bi-arrow-clockwise" style='-webkit-text-stroke: 1px;'></i></a> | ||
</div> | ||
</div> | ||
<!-- Modal --> | ||
<div class="modal fade" id="weeklyRanking" tabindex="-1" aria-labelledby="weeklyRankingLabel" aria-hidden="true"> | ||
|
@@ -64,29 +65,43 @@ <h1 class="modal-title fs-5" id="weeklyRankingLabel">Weekly ranking</h1> | |
</div> | ||
<div class="modal-body"> | ||
<div> | ||
<p class='text-muted'>{% week_start %} - {% week_end %}<p> | ||
<form id="dateForm" class='d-flex justify-content-between align-items-end'> | ||
<div class="mb-3"> | ||
<label for="startDateInput" class="form-label">Start date</label> | ||
<input type="date" class="form-control" id="startDate" name="start_date"> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="endDateInput" class="form-label">End date</label> | ||
<input type="date" class="form-control" id="endDate" name="end_date"> | ||
</div> | ||
<div class='mb-3'> | ||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</div> | ||
</form> | ||
<div class='container-fluid'> | ||
<div class='row d-flex justify-content-center'> | ||
<div class='col border rounded' style='width:300px;'> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th class='text-warning' scope="col">#</th> | ||
<th scope="col">Player</th> | ||
<th scope="col">Elo</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% get_weekly_ranking as weekly_ranking %} | ||
{% for index, member_info in weekly_ranking.items %} | ||
<tr> | ||
<th class='text-warning' scope="row">{{ index }}</th> | ||
<td>{{ member_info.name }}</td> | ||
<td><span class="badge text-bg-light">{{ member_info.eloRating }}</span></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
<div class='col border rounded' style='width:300px;' id="rankingTable"> | ||
<div id="rankingTable"> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th class='text-warning' scope="col">#</th> | ||
<th scope="col">Player</th> | ||
<th scope="col">Elo</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% get_weekly_ranking as weekly_ranking %} | ||
{% for index, member_info in weekly_ranking.items %} | ||
<tr> | ||
<th class='text-warning' scope="row">{{ index }}</th> | ||
<td>{{ member_info.name }}</td> | ||
<td><span class="badge text-bg-light">{{ member_info.eloRating }}</span></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
@@ -192,5 +207,26 @@ <h4>Clanmates stats</h4> | |
}); | ||
}); | ||
</script> | ||
<script> | ||
$(document).ready(function() { | ||
$('#dateForm').on('submit', function(e) { | ||
e.preventDefault(); | ||
var formData = $(this).serialize(); // Serialize the form data | ||
|
||
$.ajax({ | ||
url: '{% url "clanranking" clantag="G9JVLC2C" %}', | ||
type: 'POST', | ||
data: formData, | ||
headers: { 'X-Requested-With': 'XMLHttpRequest' }, | ||
success: function(response) { | ||
$('#rankingTable').html(response); | ||
}, | ||
error: function(xhr, status, error) { | ||
console.error("Error occurred: " + error); | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% load clanrankingtags %} | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th class='text-warning' scope="col">#</th> | ||
<th scope="col">Player</th> | ||
<th scope="col">Elo</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% get_weekly_ranking start_date end_date as weekly_ranking %} | ||
{% for index, member_info in weekly_ranking.items %} | ||
<tr> | ||
<th class='text-warning' scope="row">{{ index }}</th> | ||
<td>{{ member_info.name }}</td> | ||
<td><span class="badge text-bg-light">{{ member_info.eloRating }}</span></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> |
Binary file modified
BIN
-21 Bytes
(100%)
clashstats/clanranking/templatetags/__pycache__/clanrankingtags.cpython-312.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
from datetime import datetime | ||
|
||
print(datetime.now()) | ||