Skip to content

Commit a189b51

Browse files
committed
More template changes.
- Legacy-Id: 19706
1 parent 5174cb3 commit a189b51

28 files changed

Lines changed: 235 additions & 195 deletions

ietf/doc/templatetags/ballot_icon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def state_age_colored(doc):
208208
elif days > goal1:
209209
class_name = "badge bg-warning"
210210
else:
211-
class_name = "ietf-small"
211+
class_name = "badge bg-success"
212212
if days > goal1:
213213
title = ' title="Goal is <%d days"' % (goal1,)
214214
else:

ietf/static/js/list.js

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as List from "list.js";
33
var dummy = new List();
44

55
function text_sort(a, b, options) {
6+
// sort by text content
67
return dummy.utils.naturalSort.caseInsensitive($($.parseHTML(a.values()[options.valueName]))
78
.text()
89
.trim()
@@ -21,11 +22,13 @@ $(document)
2122
var header_row = $(table)
2223
.find("thead > tr:first");
2324

25+
// get field classes from first thead row
2426
var fields = $(header_row)
2527
.find("*")
2628
.map(function () {
2729
return $(this)
28-
.attr("data-sort");
30+
.attr("data-sort") ? $(this)
31+
.attr("data-sort") : "";
2932
})
3033
.toArray();
3134

@@ -45,6 +48,7 @@ $(document)
4548
header_row.addClass("visually-hidden");
4649
}
4750

51+
// HTML for the search widget
4852
var searcher = $.parseHTML(`
4953
<div class="input-group my-3">
5054
<input type="search" class="search form-control" placeholder="Search"/>
@@ -62,13 +66,46 @@ $(document)
6266
var reset_search = $(searcher)
6367
.children("button.search-reset");
6468

69+
// var pager = $.parseHTML(`
70+
// <nav aria-label="Pagination control" class="visually-hidden">
71+
// <ul class="pagination"></ul>
72+
// </nav>`);
73+
74+
// $(table)
75+
// .after(pager);
76+
6577
var list_instance = [];
6678
var internal_table = [];
6779

80+
var pagination = $(table)
81+
.children("tbody")
82+
.length == 1;
83+
84+
// list.js cannot deal with tables with multiple tbodys,
85+
// so maintain separate internal "tables" for
86+
// sorting/searching and update the DOM based on them
6887
$(table)
6988
.children("tbody")
7089
.addClass("list")
7190
.each(function () {
91+
// add the required classes to the cells
92+
$(this)
93+
.children("tr")
94+
.each(function () {
95+
$(this)
96+
.children("th, td")
97+
.each((i, e) => {
98+
$(e)
99+
.addClass(fields[i]);
100+
if (fields[i] == "date") {
101+
// magic
102+
$(e)
103+
.addClass("text-end");
104+
}
105+
});
106+
});
107+
108+
// create the internal table and add list.js to them
72109
var thead = $(this)
73110
.siblings("thead:first")
74111
.clone();
@@ -80,12 +117,26 @@ $(document)
80117
.clone()
81118
.empty()
82119
.removeClass("tablesorter")
120+
.wrap("<div id='abc'></div")
83121
.append(thead, tbody);
84122

85123
internal_table.push(parent);
86124

125+
// if (pagination) {
126+
// console.log("Enabling pager.");
127+
// $(pager)
128+
// .removeClass("visually-hidden");
129+
// pagination = {
130+
// item: '<li class="page-item"><a class="page-link" href="#"></a></li>'
131+
// };
132+
// }
133+
87134
list_instance.push(
88-
new List(parent[0], { valueNames: fields }));
135+
new List(parent[0], {
136+
valueNames: fields,
137+
// pagination: pagination,
138+
// page: 10
139+
}));
89140
});
90141

91142
reset_search.on("click", function () {

ietf/templates/doc/document_email.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ <h2>Email aliases</h2>
2727
<tbody>
2828
{% for alias in aliases %}
2929
<tr>
30-
<td class="alias">
30+
<td>
3131
<a href="mailto:{{ doc.name }}{{ alias.alias_type|default:''}}@{{ietf_domain}}">
3232
{{ doc.name }}{{ alias.alias_type|default:''}}@{{ietf_domain}}</a></td>
33-
<td class="expansion">{{ alias.expansion }}</td>
33+
<td>{{ alias.expansion }}</td>
3434
</tr>
3535
{% endfor %}
3636
</tbody>
@@ -50,10 +50,10 @@ <h2>Recipient expansions</h2>
5050
<tbody>
5151
{% for trigger,desc,to,cc in expansions %}
5252
<tr>
53-
<td class="trigger"><a href="{% url 'ietf.mailtrigger.views.show_triggers' trigger %}"
53+
<td><a href="{% url 'ietf.mailtrigger.views.show_triggers' trigger %}"
5454
title="{{desc}}">{{trigger}}</a></td>
55-
<td class="to"> {{to|join:', '}}</td>
56-
<td class="cc"> {{cc|join:', '}}</td>
55+
<td> {{to|join:', '}}</td>
56+
<td> {{cc|join:', '}}</td>
5757
</tr>
5858
{% endfor %}
5959
</tbody>

ietf/templates/doc/document_history.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ <h2>Document history</h2>
9898
<tbody>
9999
{% for e in events %}
100100
<tr class="anchor-target" id="history-{{ e.pk }}">
101-
<td class="text-nowrap date"><div title="{{ e.time|date:'Y-m-d H:i:s O' }}">{{ e.time|date:"Y-m-d" }}</div></td>
102-
<td class="text-end rev">{{ e.rev }}</td>
103-
<td class="by">{{ e.by|escape }}</td>
104-
<td class="action">{{ e.desc|format_history_text|safe }}</td>
101+
<td class="text-nowrap"><div title="{{ e.time|date:'Y-m-d H:i:s O' }}">{{ e.time|date:"Y-m-d" }}</div></td>
102+
<td class="text-end">{{ e.rev }}</td>
103+
<td>{{ e.by|escape }}</td>
104+
<td>{{ e.desc|format_history_text|safe }}</td>
105105
</tr>
106106
{% endfor %}
107107
</tbody>

ietf/templates/doc/document_referenced_by.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,26 @@ <h1>References to {{alias_name}}</h1>
4343
{% for ref in refs %}
4444
{% with ref.source.canonical_name as name %}
4545
<tr>
46-
<td class="document">
46+
<td>
4747
<a href="{% url 'ietf.doc.views_doc.document_main' name=name %}">{{ name|prettystdname }}</a>
4848
{% if ref.target.name != alias_name %}
4949
<br><span class="badge bg-info">As {{ref.target.name}}</span>
5050
{% endif %}
5151
</td>
52-
<td class="title">
52+
<td>
5353
<b>{{ref.source.title}}</b><br>
5454
<a class="btn btn-primary btn-sm" href="{% url 'ietf.doc.views_doc.document_references' name %}" rel="nofollow"><span class="bi bi-arrow-left"></span> References</a>
5555
<a class="btn btn-primary btn-sm" href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}" rel="nofollow"><span class="bi bi-arrow-right"></span> Referenced by</a>
5656
</td>
57-
<td class="status">
57+
<td>
5858
{% ifequal ref.source.get_state.slug 'rfc' %}
5959
{% with ref.source.std_level as lvl %}{% if lvl %}{{lvl}}{% endif %}{%endwith%}
6060
{% else %}
6161
{% with ref.source.intended_std_level as lvl %}{% if lvl %}{{lvl}}{% endif %}{%endwith%}
6262
{% endifequal %}
6363
</td>
64-
<td class="type">{{ref.relationship.name}}</td>
65-
<td class="downref">{{ref.is_downref|default:''}}</td>
64+
<td>{{ref.relationship.name}}</td>
65+
<td>{{ref.is_downref|default:''}}</td>
6666
</tr>
6767
{% endwith %}
6868
{% endfor %}

ietf/templates/doc/document_references.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ <h1>References from {{doc.canonical_name}}</h1>
3535
{% for ref in refs %}
3636
{% with ref.target.name as name %}
3737
<tr>
38-
<td class="document"><a href="{% url 'ietf.doc.views_doc.document_main' name=name %}">{{ name|prettystdname }}</a></td>
39-
<td class="title">
38+
<td><a href="{% url 'ietf.doc.views_doc.document_main' name=name %}">{{ name|prettystdname }}</a></td>
39+
<td>
4040
<b>{{ref.target.document.title}}</b><br>
4141
<a class="btn btn-primary btn-sm" href="{% url 'ietf.doc.views_doc.document_references' name %}" rel="nofollow"><span class="bi bi-arrow-left"></span> References</a>
4242
<a class="btn btn-primary btn-sm" href="{% url 'ietf.doc.views_doc.document_referenced_by' name %}" rel="nofollow"><span class="bi bi-arrow-right"></span> Referenced by</a>
4343
</td>
44-
<td class="status">
44+
<td>
4545
{% ifequal ref.target.document.get_state.slug 'rfc' %}
4646
{% with ref.target.document.std_level as lvl %}{% if lvl %}{{lvl}}{% endif %}{%endwith%}
4747
{% else %}
4848
{% with ref.target.document.intended_std_level as lvl %}{% if lvl %}{{lvl}}{% endif %}{%endwith%}
4949
{% endifequal %}
5050
</td>
51-
<td class="type">{{ref.relationship.name}}</td>
52-
<td class="downref">{{ref.is_downref|default:''}}</td>
51+
<td>{{ref.relationship.name}}</td>
52+
<td>{{ref.is_downref|default:''}}</td>
5353
</tr>
5454
{% endwith %}
5555
{% endfor %}

ietf/templates/doc/downref.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ <h1>{{ title }}</h1>
3030
<tbody>
3131
{% for target_doc, source_doc in doc_pairs %}
3232
<tr>
33-
<td class="ref">
33+
<td>
3434
<a href="{% url "ietf.doc.views_doc.document_main" target_doc.name %}">RFC {{ target_doc.rfc_number }}</a>
3535
<br><b>{{ target_doc.title }}</b>
3636
</td>
37-
<td class="id">
37+
<td>
3838
<a href="{% url "ietf.doc.views_doc.document_main" source_doc.name %}">{{ source_doc.name }}</a>
3939
<br><b>{{ source_doc.title }}</b>
4040
</td>

ietf/templates/doc/drafts_for_ad.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ <h1>Blocking positions held by {{ ad_name }}</h1>
2626
<tbody>
2727
{% for doc in blocked_docs %}
2828
<tr>
29-
<td class="document">{{ doc.displayname_with_link }}</td>
29+
<td>{{ doc.displayname_with_link }}</td>
3030
{% include "doc/search/status_columns.html" %}
31-
<td class="responsible">{{ doc.ad|default:"" }}</td>
32-
<td class="discusses">
31+
<td>{{ doc.ad|default:"" }}</td>
32+
<td>
3333
{% for p in doc.blocking_positions %}
3434
{{ p.balloter }}
3535
({% if p.discuss_time %}{{ p.discuss_time|timesince_days }}{% endif %}

ietf/templates/doc/drafts_in_iesg_process.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ <h1>{{ title }}</h1>
3131
<tbody>
3232
{% for doc in docs %}
3333
<tr>
34-
<td class="area text-nowrap">{% if doc.area_acronym %}{{ doc.area_acronym }}{% endif %}</td>
35-
<td class="date text-nowrap">
34+
<td class="text-nowrap">{% if doc.area_acronym %}{{ doc.area_acronym }}{% endif %}</td>
35+
<td class="text-nowrap">
3636
{% if state.slug == "lc" %}
3737
{% if doc.lc_expires %}{{ doc.lc_expires|date:"Y-m-d" }}{% endif %}
3838
{% else %}
3939
{{ doc.time|date:"Y-m-d" }}
4040
{% endif %}
4141
</td>
4242

43-
<td class="doc">
43+
<td>
4444
<a href="{% url "ietf.doc.views_doc.document_main" doc.name %}">{{ doc.name }}</a>
4545
<br><b>{{ doc.title }}</b>
4646
{% if doc.action_holders_enabled and doc.action_holders.exists %}
@@ -53,8 +53,8 @@ <h1>{{ title }}</h1>
5353
<br><i>Note: {{ doc.note|linkify|linebreaksbr }}</i>
5454
{% endif %}
5555
</td>
56-
<td class="level">{{ doc.intended_std_level.name }}</td>
57-
<td class="ad">{% person_link doc.ad %}</td>
56+
<td>{{ doc.intended_std_level.name }}</td>
57+
<td>{% person_link doc.ad %}</td>
5858
</tr>
5959
{% endfor %}
6060
</tbody>

ietf/templates/doc/irsg_ballot_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h1>IRSG ballot status</h1>
2626
<tbody>
2727
{% for doc in docs %}
2828
<tr>
29-
<td class="doc">
29+
<td>
3030
{{ doc.displayname_with_link }}
3131
</td>
3232
{% include "doc/search/status_columns.html" %}

0 commit comments

Comments
 (0)