Private
Public Access
1
0

Merge branch 'release/v20.7.2'

This commit is contained in:
2024-04-02 20:45:19 +02:00

View File

@@ -11,6 +11,9 @@
#mypointer { #mypointer {
cursor: pointer; cursor: pointer;
} }
tr:hover {
background-color: #f5f5f5;
}
</style> </style>
@@ -58,15 +61,18 @@
<form enctype="multipart/form-data" method="post"> <form enctype="multipart/form-data" method="post">
{% csrf_token %} {% csrf_token %}
<input name="courses" type="submit" value="Download selected courses"> <input name="courses" type="submit" value="Download selected courses">
<table width="100%" class="listtable shortpadded"> Click on a column header to sort the table.
<table width="100%" class="listtable shortpadded" id="courseTable">
<thead> <thead>
<tr> <tr>
<th> Download</th> <th> Download</th>
<th> Country</th> <th onClick="sortTable(1)"> Country</th>
<th> Name</th> <th onClick="sortTable(2)"> Name</th>
<th> Distance</th> <th onClick="sortTable(3)"> Distance</th>
<th> Updated on</th> <th onClick="sortTable(4)"> Updated on</th>
<th> Like</th> {% if not user.is_anonymous %}
<th onClick="sortTable(5)"> Like</th>
{% endif %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -83,6 +89,7 @@
<td> <td>
{{ course.updated|date:"Y-m-d" }} {{ course.updated|date:"Y-m-d" }}
</td> </td>
{% if not user.is_anonymous %}
<td> <td>
{% if course in rower.followed_courses.all %} {% if course in rower.followed_courses.all %}
<a class="unfollow" href="/rowers/courses/{{ course.id }}/unfollow"><span class="icon"><i class="fas fa-star"></i></span></a> <a class="unfollow" href="/rowers/courses/{{ course.id }}/unfollow"><span class="icon"><i class="fas fa-star"></i></span></a>
@@ -90,6 +97,7 @@
<a class="follow" href="/rowers/courses/{{ course.id }}/follow"><span class="icon"><i class="far fa-star"></i></span></a> <a class="follow" href="/rowers/courses/{{ course.id }}/follow"><span class="icon"><i class="far fa-star"></i></span></a>
{% endif %} {% endif %}
</tr> </tr>
{% endif %}
{% endfor %} {% endfor %}
</tbody> </tbody>
@@ -211,8 +219,40 @@
}); });
</script> </script>
<script>
var ascending = true;
function sortTable(col) {
var table, rows, switching, i, x, y, shouldSwitch;
table = document.getElementById("courseTable");
switching = true;
while (switching) {
switching = false;
rows = table.rows;
for (i = 1; i < (rows.length - 1); i++) {
shouldSwitch = false;
x = rows[i].getElementsByTagName("td")[col];
y = rows[i + 1].getElementsByTagName("td")[col];
if (ascending) {
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
shouldSwitch = true;
break;
}
} else {
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
shouldSwitch = true;
break;
}
}
}
if (shouldSwitch) {
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
}
}
ascending = !ascending; // Reverse the sorting order
}
</script>
{% endblock %} {% endblock %}
{% block sidebar %} {% block sidebar %}