1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

Dash, sort by issues number

This commit is contained in:
Nathanaël Hannebert 2024-06-21 13:19:49 +02:00
parent 9b61281df7
commit 58333456fb

View file

@ -44,6 +44,8 @@
<option {% if request.args.get("sort") in [None, "stars"] %}selected{% endif %} value="stars">{{ _("Popularity stars") }}</option> <option {% if request.args.get("sort") in [None, "stars"] %}selected{% endif %} value="stars">{{ _("Popularity stars") }}</option>
<option {% if request.args.get("sort") == "main_branch_update" %}selected{% endif %} value="main_branch_update">{{ _("Last update on main/master branch") }}</option> <option {% if request.args.get("sort") == "main_branch_update" %}selected{% endif %} value="main_branch_update">{{ _("Last update on main/master branch") }}</option>
<option {% if request.args.get("sort") == "testing_branch_update" %}selected{% endif %} value="testing_branch_update">{{ _("Last update on testing branch") }}</option> <option {% if request.args.get("sort") == "testing_branch_update" %}selected{% endif %} value="testing_branch_update">{{ _("Last update on testing branch") }}</option>
<option {% if request.args.get("sort") == "nb_issues" %}selected{% endif %} value="nb_issues">{{ _("Issues number") }}</option>
</select> </select>
</div> </div>
<div class="w-fit mx-auto flex items-center px-2 pt-2"> <div class="w-fit mx-auto flex items-center px-2 pt-2">
@ -400,6 +402,11 @@
return a.dataset.app > b.dataset.app ? 1 : -1; return a.dataset.app > b.dataset.app ? 1 : -1;
}); });
} }
else if (sortBy === "nb_issues") {
toSort.sort(function(a, b) {
return b.dataset.nbIssues - a.dataset.nbIssues;
});
}
for(var i = 0, l = toSort.length; i < l; i++) { for(var i = 0, l = toSort.length; i < l; i++) {
toSort[i].remove() toSort[i].remove()
table.appendChild(toSort[i]); table.appendChild(toSort[i]);