Skip to content

Commit

Permalink
fix: Sort RFCs by date (#7766)
Browse files Browse the repository at this point in the history
* fix: Sort RFCs by date

* fix: concluded wgs and bofs date sort #7350
  • Loading branch information
holloway authored Aug 1, 2024
1 parent 247361b commit fb1942a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions ietf/static/js/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import {
function text_sort(a, b, options) {

function prep(e, options) {
return $($.parseHTML(e.values()[options.valueName]))
.text()
const el = $($.parseHTML(e.values()[options.valueName]));
const cell_el = e.elm.querySelector(`.${options.valueName}`)
const sort_by_number = cell_el?.getAttribute('data-sort-number')
return sort_by_number ?? el.text()
.trim()
.replaceAll(/\s+/g, ' ');
}
Expand Down
8 changes: 4 additions & 4 deletions ietf/templates/group/concluded_groups.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ <h2 class="mt-5" id="{{ label|slugify }}">{{ label }}</h2>
<tr>
<th scope="col" data-sort="group">Group</th>
<th scope="col" data-sort="name">Name</th>
<th scope="col" data-sort="date">Start</th>
<th scope="col" data-sort="date">Concluded</th>
<th scope="col" data-sort="date-start">Start</th>
<th scope="col" data-sort="date-concluded">Concluded</th>
</tr>
</thead>
<tbody>
Expand All @@ -51,8 +51,8 @@ <h2 class="mt-5" id="{{ label|slugify }}">{{ label }}</h2>
<a href="{{ g.about_url }}">{{ g.acronym }}</a>
</td>
<td>{{ g.name }}</td>
<td>{{ g.start_date|date:"Y-m" }}</td>
<td>{{ g.conclude_date|date:"Y-m" }}</td>
<td data-sort-number="{{ g.start_date|date:"U" }}">{{ g.start_date|date:"Y-m" }}</td>
<td data-sort-number="{{ g.conclude_date|date:"U" }}">{{ g.conclude_date|date:"Y-m" }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/person/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h2 class="mt-5" id="rfcs-{{ forloop.counter }}">
<td>
<a class="text-nowrap" href="{{ doc.get_absolute_url }}">RFC {{ doc.rfc_number }}</a>
</td>
<td>{{ doc.pub_date|date:"b Y"|title }}</td>
<td data-sort-number="{{ doc.pub_date|date:"U" }}">{{ doc.pub_date|date:"b Y"|title }}</td>
<td>{{ doc.title|urlize_ietf_docs }}</td>
<td class="text-end">
{% with doc.referenced_by_rfcs_as_rfc_or_draft.count as refbycount %}
Expand Down

0 comments on commit fb1942a

Please sign in to comment.