Skip to content

Commit b3aeb6b

Browse files
author
Brandon Green
committed
Add ability to sort ecosystem cards by title
1 parent 0f7c647 commit b3aeb6b

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

_includes/ecosystem_sort.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
<li>
2121
<a class="ecosystem-filter" id="sortDateOld">Date Added - Oldest</a>
2222
</li>
23+
24+
<li>
25+
<a class="ecosystem-filter" id="sortTitleHigh">Title - A-Z</a>
26+
</li>
27+
28+
<li>
29+
<a class="ecosystem-filter" id="sortTitleLow">Title - Z-A</a>
30+
</li>
2331
</ul>
2432
</div>
2533
</div>

assets/filter-hub-tags.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var displayCount = Number(filterScript.attr("display-count"));
44
var pagination = filterScript.attr("pagination");
55

66
var options = {
7-
valueNames: ["github-stars-count-whole-number", { data: ["tags", "date-added"] }],
7+
valueNames: ["github-stars-count-whole-number", { data: ["tags", "date-added"] }, { data: ["tags", "title"] }],
88
page: displayCount
99
};
1010

@@ -92,3 +92,11 @@ $("#sortDateNew").on("click", function() {
9292
$("#sortDateOld").on("click", function() {
9393
hubList.sort("date-added", { order: "asc" });
9494
});
95+
96+
$("#sortTitleLow").on("click", function() {
97+
hubList.sort("title", { order: "desc" });
98+
});
99+
100+
$("#sortTitleHigh").on("click", function() {
101+
hubList.sort("title", { order: "asc" });
102+
});

ecosystem/ecosystem.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h1>
3434
{% assign ecosystem = site.ecosystem | sort_natural: "title" %}
3535

3636
{% for item in ecosystem %}
37-
<div class="col-md-6 ecosystem-card-wrapper" id="ecosystemCards" data-categories="{{ item.category | join: "," }}" data-date-added="{{ item.date-added }}">
37+
<div class="col-md-6 ecosystem-card-wrapper" id="ecosystemCards" data-categories="{{ item.category | join: "," }}" data-date-added="{{ item.date-added }}" data-title="{{ item.title }}">
3838
<div class="card ecosystem-card">
3939
<a href="{{ item.link }}" target="_blank">
4040
<div class="card-body {{ item.logo-class }} {% if item.experimental %}experimental{% endif %}">

0 commit comments

Comments
 (0)