fix: Sort RFCs by date (#7766)

* fix: Sort RFCs by date

* fix: concluded wgs and bofs date sort #7350
This commit is contained in:
Matthew Holloway 2024-08-02 07:25:03 +12:00 committed by GitHub
parent 247361b7dd
commit fb1942a538
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 7 deletions

View file

@ -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, ' ');
}

View file

@ -40,8 +40,8 @@
<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>
@ -51,8 +51,8 @@
<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>

View file

@ -106,7 +106,7 @@
<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 %}