Skip to content

Commit 8e5837c

Browse files
authored
Merge pull request #89 from Xpirix/created_at_sorting
Add sorting option by creation date in plugin list
2 parents 4a6d5db + 5d263cd commit 8e5837c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

qgis-app/plugins/templates/plugins/plugin_list_sort.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<option value="name" {% if request.GET.sort == 'name' %}selected{% endif %}>{% trans "Name" %}</option>
99
<option value="downloads" {% if request.GET.sort == 'downloads' %}selected{% endif %}>{% trans "Downloads" %}</option>
1010
<option value="author" {% if request.GET.sort == 'author' %}selected{% endif %}>{% trans "Author" %}</option>
11+
<option value="created_on" {% if request.GET.sort == 'created_on' %}selected{% endif %}>{% trans "Created On" %}</option>
1112
<option value="latest_version_date" {% if request.GET.sort == 'latest_version_date' %}selected{% endif %}>{% trans "Latest Version" %}</option>
1213
<option value="weighted_rating" {% if request.GET.sort == 'weighted_rating' %}selected{% endif %}>{% trans "Stars" %}</option>
1314
</select>
@@ -35,7 +36,11 @@
3536

3637
// Preserve the other sorting option (sort/order)
3738
if (key === 'sort' && !params.has('order')) {
38-
params.set('order', 'asc'); // Default to ascending if no order is selected
39+
if (value === 'name' || value === 'author') {
40+
params.set('order', 'asc'); // Default to descending if sorting by weighted rating
41+
} else {
42+
params.set('order', 'desc'); // Default to ascending if no order is selected
43+
}
3944
} else if (key === 'order' && !params.has('sort')) {
4045
params.set('sort', 'name'); // Default to sorting by name if no sort field is selected
4146
}

0 commit comments

Comments
 (0)