Skip to content

Commit d2861df

Browse files
committed
Sort download entries by weight
1 parent 65ab609 commit d2861df

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

layouts/partials/section/downloads.html.twig

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,36 @@
1616
{% block section_content %}
1717
<div class="row row-cols-1 row-cols-md-1 row-cols-lg-1">
1818

19-
{% set repos = site.data.github.libimobiledevice.repos | filter(p => site.data.github.libimobiledevice[p.name].releases.latest is defined) | sort((a, b) => a.stargazers_count < b.stargazers_count) %}
20-
19+
{% set repos = site.data.github.libimobiledevice.repos | filter(p => site.data.github.libimobiledevice[p.name].releases.latest is defined) %}
20+
{% set updated = [] %}
21+
{% for repo in repos %}
22+
{% set weight = 0 %}
23+
{% if repo.name == 'libimobiledevice' %}
24+
{% set weight = 20 %}
25+
{% elseif repo.name == 'libplist' %}
26+
{% set weight = 19 %}
27+
{% elseif repo.name == 'libimobiledevice-glue' %}
28+
{% set weight = 18 %}
29+
{% elseif repo.name == 'libusbmuxd' %}
30+
{% set weight = 17 %}
31+
{% elseif repo.name == 'usbmuxd' %}
32+
{% set weight = 16 %}
33+
{% elseif repo.name == 'ideviceinstaller' %}
34+
{% set weight = 15 %}
35+
{% elseif repo.name == 'libirecovery' %}
36+
{% set weight = 14 %}
37+
{% elseif repo.name == 'libtatsu' %}
38+
{% set weight = 13 %}
39+
{% elseif repo.name == 'libideviceactivation' %}
40+
{% set weight = 12 %}
41+
{% elseif repo.name == 'idevicerestore' %}
42+
{% set weight = 11 %}
43+
{% elseif repo.name == 'ifuse' %}
44+
{% set weight = 10 %}
45+
{% endif %}
46+
{% set updated = updated|merge([repo|merge({'weight': weight})]) %}
47+
{% endfor %}
48+
{% set repos = updated | sort((a, b) => a.weight < b.weight) %}
2149
{% for repo in repos %}
2250
{% set release = site.data.github.libimobiledevice[repo.name].releases.latest %}
2351
<div class="col mb-4">

0 commit comments

Comments
 (0)