fix: Use unique data-sort attributes (#3836)

* fix: Use unique `data-sort` attributes

So list.js properly sorts columns.

* Address @rjsparks' comments
This commit is contained in:
Lars Eggert 2022-04-19 18:16:32 +03:00 committed by GitHub
parent ea22b0fd3b
commit f8c06fa5cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 83 additions and 80 deletions

0
docker/scripts/app-create-dirs.sh Normal file → Executable file
View file

View file

@ -25,7 +25,10 @@ function replace_with_internal(table, internal_table, i) {
function field_magic(i, e, fields) {
if ($(e)
.attr("colspan") === undefined && (fields[i] == "num" || fields[i] == "count" || fields[i] == "id")) {
.attr("colspan") === undefined &&
(fields[i] == "num" || fields[i] == "count" ||
fields[i] == "percent" || fields[i] == "id" ||
fields[i].endsWith("-num") || fields[i].endsWith("-date"))) {
$(e)
.addClass("text-end");
}
@ -276,4 +279,4 @@ $(document)
$(table)[0]
.dispatchEvent(new Event("tablesorter:done"));
});
});
});

View file

@ -17,11 +17,11 @@
<tr>
<th scope="col" data-sort="num">#</th>
<th scope="col" data-sort="query">SQL</th>
<th scope="col" data-sort="num">Count</th>
<th scope="col" data-sort="count">Count</th>
<th scope="col" data-sort="where">WHERE</th>
<th scope="col" data-sort="num">View/Templ.</th>
<th scope="col" data-sort="num">Time</th>
<th scope="col" data-sort="num">Acc.</th>
<th scope="col" data-sort="view-num">View/Templ.</th>
<th scope="col" data-sort="time-num">Time</th>
<th scope="col" data-sort="acc-num">Acc.</th>
</tr>
</thead>
<tbody>
@ -107,4 +107,4 @@
Add <code>ietf.context_processors.sql_debug</code> to <code>settings.DEV_TEMPLATE_CONTEXT_PROCESSORS</code> to turn on the SQL statement table.
</small>
{% endif %}
{% endif %}
{% endif %}

View file

@ -22,10 +22,10 @@
<tr>
<th scope="col" data-sort="request">Request</th>
<th scope="col" data-sort="type">Type</th>
<th scope="col" data-sort="date">Requested</th>
<th scope="col" data-sort="date">Deadline</th>
<th scope="col" data-sort="req-date">Requested</th>
<th scope="col" data-sort="deadline-date">Deadline</th>
<th scope="col" data-sort="state">Document state</th>
<th scope="col" data-sort="date">IESG Telechat</th>
<th scope="col" data-sort="telechat-date">IESG Telechat</th>
</tr>
</thead>
<tbody>
@ -71,11 +71,11 @@
<tr>
<th scope="col" data-sort="request">Request</th>
<th scope="col" data-sort="type">Type</th>
<th scope="col" data-sort="date">Requested</th>
<th scope="col" data-sort="date">Deadline</th>
<th scope="col" data-sort="req-date">Requested</th>
<th scope="col" data-sort="deadline-date">Deadline</th>
<th scope="col" data-sort="reviewer">Reviewer</th>
<th scope="col" data-sort="state">Document state</th>
<th scope="col" data-sort="date">IESG Telechat</th>
<th scope="col" data-sort="telechat-date">IESG Telechat</th>
</tr>
</thead>
<tbody>
@ -133,13 +133,13 @@
<th scope="col" data-sort="type">
Type
</th>
<th scope="col" data-sort="date">
<th scope="col" data-sort="req-date">
Requested
</th>
<th scope="col" data-sort="date">
<th scope="col" data-sort="deadline-date">
Deadline
</th>
<th scope="col" data-sort="date">
<th scope="col" data-sort="closed-date">
Closed
</th>
<th scope="col" data-sort="state">
@ -188,13 +188,13 @@
<th scope="col" data-sort="type">
Type
</th>
<th scope="col" data-sort="date">
<th scope="col" data-sort="assgn-date">
Assigned
</th>
<th scope="col" data-sort="date">
<th scope="col" data-sort="deadline-date">
Deadline
</th>
<th scope="col" data-sort="date">
<th scope="col" data-sort="closed-date">
Closed
</th>
<th scope="col" data-sort="reviewer">

View file

@ -6,7 +6,7 @@
<th scope="col" data-sort="date">Date</th>
<th scope="col" data-sort="from">From</th>
<th scope="col" class="d-none d-sm-table-cell" data-sort="to">To</th>
<th scope="col" class="d-none d-sm-table-cell" data-sort="date">Deadline</th>
<th scope="col" class="d-none d-sm-table-cell" data-sort="deadline-date">Deadline</th>
<th scope="col" data-sort="title">Title</th>
</tr>
</thead>
@ -36,4 +36,4 @@
{% endfor %}
</tbody>
{% endif %}
</table>
</table>

View file

@ -30,7 +30,7 @@
<thead>
<tr>
<th scope="col" data-sort="group">Group</th>
<th scope="col" data-sort="num">Length</th>
<th scope="col" data-sort="count">Length</th>
<th scope="col" data-sort="num">Size</th>
<th scope="col" class="d-none d-sm-table-cell" data-sort="requester">Requester</th>
<th scope="col" class="d-none d-sm-table-cell" data-sort="ad">AD</th>

View file

@ -13,15 +13,15 @@
<tr>
<th scope="col" data-sort="position">Position</th>
<th scope="col" data-sort="open">Open</th>
<th scope="col" data-sort="accepting">Accepting nominations</th>
<th scope="col" data-sort="accepting">Accepting feedback</th>
<th scope="col" data-sort="num">Nominations</th>
<th scope="col" data-sort="num">Unique nominees</th>
<th scope="col" data-sort="num">Accepted</th>
<th scope="col" data-sort="num">Declined</th>
<th scope="col" data-sort="num">Pending</th>
<th scope="col" data-sort="num">Questionnaire responses</th>
<th scope="col" data-sort="num">Comments</th>
<th scope="col" data-sort="accepting-nom-num">Accepting nominations</th>
<th scope="col" data-sort="accepting-fb-num">Accepting feedback</th>
<th scope="col" data-sort="nom-num">Nominations</th>
<th scope="col" data-sort="uniq-num">Unique nominees</th>
<th scope="col" data-sort="acc-num">Accepted</th>
<th scope="col" data-sort="decl-num">Declined</th>
<th scope="col" data-sort="pend-num">Pending</th>
<th scope="col" data-sort="resp-num">Questionnaire responses</th>
<th scope="col" data-sort="comm-num">Comments</th>
</tr>
</thead>
{% if stats %}
@ -246,4 +246,4 @@
{% endblock %}
{% block js %}
<script src="{% static "ietf/js/list.js" %}"></script>
{% endblock %}
{% endblock %}

View file

@ -24,7 +24,7 @@
<th scope="col" data-sort="first">First name</th>
<th scope="col" data-sort="last">Last name</th>
<th scope="col" data-sort="email">Email</th>
{% for ft in nominee_feedback_types %}<th scope="col" data-sort="num">{{ ft.name }}</th>{% endfor %}
{% for ft in nominee_feedback_types %}<th scope="col" data-sort="{{ ft.name|slugify }}-num">{{ ft.name }}</th>{% endfor %}
</tr>
</thead>
<tbody>
@ -61,7 +61,7 @@
<thead>
<tr>
<th scope="col" data-sort="topic">Topic</th>
{% for ft in topic_feedback_types %}<th scope="col" data-sort="num">{{ ft.name }}</th>{% endfor %}
{% for ft in topic_feedback_types %}<th scope="col" data-sort="{{ ft.name|slugify }}-num">{{ ft.name }}</th>{% endfor %}
</tr>
</thead>
<tbody>
@ -88,7 +88,7 @@
<thead>
<tr>
<th scope="col"></th>
{% for ft in independent_feedback_types %}<th scope="col" data-sort="num">{{ ft.name }}</th>{% endfor %}
{% for ft in independent_feedback_types %}<th scope="col" data-sort="{{ ft.name|slugify }}-num">{{ ft.name }}</th>{% endfor %}
</tr>
</thead>
<tbody>
@ -104,4 +104,4 @@
{% endblock %}
{% block js %}
<script src="{% static "ietf/js/list.js" %}"></script>
{% endblock %}
{% endblock %}

View file

@ -85,7 +85,7 @@
<th scope="col" data-sort="rfc">RFC</th>
<th scope="col" data-sort="date">Date</th>
<th scope="col" data-sort="title">Title</th>
<th scope="col" data-sort="title">Cited by</th>
<th scope="col" data-sort="citedby">Cited by</th>
</thead>
<tbody>
{% for doc in person.rfcs %}
@ -172,4 +172,4 @@
});
});
</script>
{% endblock %}
{% endblock %}

View file

@ -45,8 +45,8 @@
<thead>
<tr>
<th scope="col" data-sort="affiliation">Affiliation</th>
<th scope="col" data-sort="num">Percentage of authors</th>
<th scope="col" data-sort="num">Authors</th>
<th scope="col" data-sort="percent">Percentage of authors</th>
<th scope="col" data-sort="count">Authors</th>
</tr>
</thead>
{% if table_data %}
@ -110,4 +110,4 @@
<p>
<a href="{{ show_aliases_url }}" class="btn btn-primary">Show generated aliases</a>
</p>
{% endif %}
{% endif %}

View file

@ -52,7 +52,7 @@
<thead>
<tr>
<th scope="col" data-sort="num">Citations</th>
<th scope="col" data-sort="num">Percentage of authors</th>
<th scope="col" data-sort="percent">Percentage of authors</th>
<th scope="col" data-sort="authors">Authors</th>
</tr>
</thead>
@ -69,4 +69,4 @@
{% endif %}
</table>
<p>Note that the citation counts do not exclude self-references.</p>
<p>Note that the citation counts do not exclude self-references.</p>

View file

@ -45,8 +45,8 @@
<thead>
<tr>
<th scope="col" data-sort="continent">Continent</th>
<th scope="col" data-sort="num">Percentage of authors</th>
<th scope="col" data-sort="num">Authors</th>
<th scope="col" data-sort="percent">Percentage of authors</th>
<th scope="col" data-sort="count">Authors</th>
</tr>
</thead>
{% if table_data %}
@ -66,4 +66,4 @@
with each draft. Since this varies across documents, a traveling
author may be counted in more than country, making the total sum
more than 100%.
</p>
</p>

View file

@ -45,7 +45,7 @@
<thead>
<tr>
<th scope="col" data-sort="country">Country</th>
<th scope="col" class="text-end" data-sort="percentage">Percentage of authors</th>
<th scope="col" class="text-end" data-sort="percent">Percentage of authors</th>
<th scope="col" class="text-end" data-sort="authors">Authors</th>
</tr>
</thead>
@ -133,4 +133,4 @@
<p>
<a href="{{ show_aliases_url }}" class="btn btn-primary">Show generated aliases</a>
</p>
{% endif %}
{% endif %}

View file

@ -51,8 +51,8 @@
<thead>
<tr>
<th scope="col" data-sort="num">Documents</th>
<th scope="col" data-sort="num">Percentage of authors</th>
<th scope="col" data-sort="num">Authors</th>
<th scope="col" data-sort="percent">Percentage of authors</th>
<th scope="col" data-sort="count">Authors</th>
</tr>
</thead>
{% if table_data %}
@ -66,4 +66,4 @@
{% endfor %}
</tbody>
{% endif %}
</table>
</table>

View file

@ -50,7 +50,7 @@
<thead>
<tr>
<th scope="col" data-sort="num">h-index</th>
<th scope="col" data-sort="num">Percentage of authors</th>
<th scope="col" data-sort="percent">Percentage of authors</th>
<th scope="col" data-sort="Authors">Authors</th>
</tr>
</thead>
@ -80,4 +80,4 @@
</p>
<p>
Note that the h-index calculations do not exclude self-references.
</p>
</p>

View file

@ -50,8 +50,8 @@
<thead>
<tr>
<th scope="col" data-sort="num">Authors</th>
<th scope="col" data-sort="num">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="num">{{ doc_label|capfirst }}s</th>
<th scope="col" data-sort="percent">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="count">{{ doc_label|capfirst }}s</th>
</tr>
</thead>
{% if table_data %}
@ -65,4 +65,4 @@
{% endfor %}
</tbody>
{% endif %}
</table>
</table>

View file

@ -46,7 +46,7 @@
<thead>
<tr>
<th scope="col" data-sort="format">Format</th>
<th scope="col" data-sort="num">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="percent">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="label">{{ doc_label|capfirst }}s</th>
</tr>
</thead>
@ -61,4 +61,4 @@
{% endfor %}
</tbody>
{% endif %}
</table>
</table>

View file

@ -46,8 +46,8 @@
<thead>
<tr>
<th scope="col" data-sort="formal">Formal language</th>
<th scope="col" data-sort="num">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="num">{{ doc_label|capfirst }}s</th>
<th scope="col" data-sort="percent">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="count">{{ doc_label|capfirst }}s</th>
</tr>
</thead>
{% if table_data %}
@ -61,4 +61,4 @@
{% endfor %}
</tbody>
{% endif %}
</table>
</table>

View file

@ -44,8 +44,8 @@
<thead>
<tr>
<th scope="col" data-sort="num">Pages</th>
<th scope="col" data-sort="num">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="num">{{ doc_label|capfirst }}s</th>
<th scope="col" data-sort="percent">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="count">{{ doc_label|capfirst }}s</th>
</tr>
</thead>
{% if table_data %}
@ -59,4 +59,4 @@
{% endfor %}
</tbody>
{% endif %}
</table>
</table>

View file

@ -44,8 +44,8 @@
<thead>
<tr>
<th scope="col" data-sort="num">Words</th>
<th scope="col" data-sort="num">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="num">{{ doc_label|capfirst }}s</th>
<th scope="col" data-sort="percent">Percentage of {{ doc_label }}s</th>
<th scope="col" data-sort="count">{{ doc_label|capfirst }}s</th>
</tr>
</thead>
{% if table_data %}
@ -59,4 +59,4 @@
{% endfor %}
</tbody>
{% endif %}
</table>
</table>

View file

@ -45,8 +45,8 @@
<thead>
<tr>
<th scope="col" data-sort="continent">Continent</th>
<th scope="col" data-sort="num">Percentage of attendees</th>
<th scope="col" data-sort="num">Attendees</th>
<th scope="col" data-sort="percent">Percentage of attendees</th>
<th scope="col" data-sort="count">Attendees</th>
</tr>
</thead>
<tbody>
@ -58,4 +58,4 @@
</tr>
{% endfor %}
</tbody>
</table>
</table>

View file

@ -128,7 +128,7 @@
<th scope="col" data-sort="city">City</th>
<th scope="col" data-sort="country">Country</th>
<th scope="col" data-sort="continent">Continent</th>
<th scope="col" data-sort="num">Attendees</th>
<th scope="col" data-sort="count">Attendees</th>
</tr>
</thead>
<tbody>
@ -157,4 +157,4 @@
{% endfor %}
</tbody>
</table>
{% endif %}
{% endif %}

View file

@ -150,19 +150,19 @@
Reviewer
{% endif %}
</th>
<th scope="col" data-sort="num"
<th scope="col" data-sort="req-num"
title="Requests that are currently requested or accepted by reviewer">Open in time</th>
<th scope="col" data-sort="num"
<th scope="col" data-sort="past-num"
title="Requests that are currently requested or accepted by reviewer and past the deadline">
Open late
</th>
<th scope="col" data-sort="num"
<th scope="col" data-sort="comp-num"
title="Requests that have been completed partially or completely">Completed in time</th>
<th scope="col" data-sort="num"
<th scope="col" data-sort="comppast-num"
title="Requests that have been completed partially or completely past the deadline">
Completed late
</th>
<th scope="col" data-sort="num"
<th scope="col" data-sort="rej-num"
title="Requests that are rejected by the reviewer, withdrawn, overtaken by events or with no response from reviewer">
Not completed
</th>
@ -211,7 +211,7 @@
{% endif %}
</th>
{% for r in results %}
<th scope="col" data-sort="num">
<th scope="col" data-sort="{{ r.name|slugify }}-num">
{{ r.name }}
</th>
{% endfor %}
@ -248,7 +248,7 @@
{% endif %}
</th>
{% for s in states %}
<th scope="col" data-sort="num">
<th scope="col" data-sort="{{ s.name|slugify }}-num">
{{ s.name }}
</th>
{% endfor %}

2
package-lock.json generated
View file

@ -1,5 +1,5 @@
{
"name": "datatracker",
"name": "workspace",
"lockfileVersion": 2,
"requires": true,
"packages": {