Skip to content

Commit 79f49fe

Browse files
committed
Merged in [10614] from lars@netapp.com:
Use jquery tablesorter to change the ordering of document search tables - Legacy-Id: 10644 Note: SVN reference [10614] has been migrated to Git commit e920d0b
1 parent faea7c9 commit 79f49fe

12 files changed

Lines changed: 121 additions & 19 deletions

File tree

ietf/bower.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"html5shiv": "3.7.3",
1111
"jquery": "1.11.3",
1212
"jquery.cookie": "1.4.1",
13+
"jquery.tablesorter": "2.25.0",
1314
"respond": "1.4.2",
1415
"select2": "3.5.4",
1516
"select2-bootstrap-css": "1.4.6"
@@ -22,6 +23,12 @@
2223
"./fonts/*"
2324
]
2425
},
26+
"tablesorter": {
27+
"main": [
28+
"dist/js/jquery.tablesorter.combined.js",
29+
"dist/css/theme.bootstrap.min.css"
30+
]
31+
},
2532
"respond": {
2633
"main": "dest/respond.min.js"
2734
}

ietf/externals/static/jquery.tablesorter/css/theme.bootstrap.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ietf/externals/static/jquery.tablesorter/js/jquery.tablesorter.combined.min.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ietf/static/ietf/css/ietf.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,3 +439,18 @@ form.navbar-form input.form-control.input-sm { width: 141px; }
439439
pointer-events: none;
440440
}
441441

442+
/* revert some of the tablesorter theme back to bootstrap defaults */
443+
.tablesorter-bootstrap .bootstrap-icon-unsorted {
444+
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAOCAMAAADOvxanAAAAVFBMVEUAAABCQkJZWVkZGRnJyckgICAZGRkZGRn8/PweHh4dHR0aGhoaGhpUVFQbGxvQ0NDc3NxMTExSUlIbGxvr6+s4ODhKSkogICAtLS00NDQzMzMnJydSEPrQAAAAGHRSTlMA1ssZRLgdAQbDyisqsZo8QdXUq0r9xPepSRwiAAAAX0lEQVQI13XHSQKAIAwEwQAKxn13Ev7/T2Pu9qmarJKPXIicI4PH4hxaKNrhm2S8bJK5h4YzKHrzJNtK6yYT/TdXzpS5zuYg4MSQYF6i4IHExdw1UVRi05HPrrvT53a+qyMFC9t04gcAAAAASUVORK5CYII=)
445+
}
446+
447+
.tablesorter-bootstrap { width: inherit; }
448+
449+
450+
.tablesorter-bootstrap thead tr th {
451+
background-color: inherit;
452+
font-family: inherit;
453+
font-size: inherit;
454+
padding: inherit;
455+
outline: inherit;
456+
}

ietf/static/ietf/js/ietf.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,23 @@ $(document).ready(function () {
242242
}
243243
});
244244
});
245+
246+
$(function() {
247+
// customize the styling a bit; more is done in ietf.css
248+
if ($(".tablesorter").length) {
249+
$.tablesorter.themes.bootstrap = {
250+
table: "",
251+
iconSortNone: "bootstrap-icon-unsorted",
252+
iconSortAsc: "glyphicon glyphicon-chevron-up",
253+
iconSortDesc: "glyphicon glyphicon-chevron-down",
254+
hover: "active"
255+
};
256+
$(".tablesorter").tablesorter({
257+
emptyTo: "zero",
258+
theme: "bootstrap",
259+
table: "",
260+
headerTemplate: "{content} {icon}",
261+
widgets: ["uitheme", "sort2Hash"]
262+
});
263+
}
264+
});
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{% extends "base.html" %}
22
{# Copyright The IETF Trust 2015, All Rights Reserved #}
3-
{% load origin %}
3+
{% load origin staticfiles %}
4+
5+
{% block pagehead %}
6+
<link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}">
7+
{% endblock %}
48

59
{% block title %}Documents for {{ ad_name }}{% endblock %}
610

@@ -9,3 +13,7 @@
913
<h1>Documents for {{ ad_name }}</h1>
1014
{% include "doc/search/search_results.html" %}
1115
{% endblock %}
16+
17+
{% block js %}
18+
<script src="{% static "jquery.tablesorter/js/jquery.tablesorter.combined.min.js" %}"></script>
19+
{% endblock %}

ietf/templates/doc/drafts_in_iesg_process.html

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
{# Copyright The IETF Trust 2015, All Rights Reserved #}
33
{% load origin %}
44

5-
{% load ietf_filters %}
5+
{% load ietf_filters staticfiles %}
66

77
{% block pagehead %}
88
{% if last_call_only %}
99
<link rel="alternate" type="application/atom+xml" href="/feed/last-call/">
1010
{% endif %}
11+
<link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}">
1112
{% endblock %}
1213

1314
{% block title %}{{ title }}{% endblock %}
@@ -16,18 +17,21 @@
1617
{% origin %}
1718
<h1>{{ title }}</h1>
1819

19-
<table class="table table-condensed table-striped">
20+
<table class="table table-condensed table-striped tablesorter">
2021
<thead>
2122
<tr>
2223
<th class="text-nowrap">Area</th>
2324
<th class="text-nowrap">{% if state.slug == "lc" %}Expires at{% else %}Date{% endif %}</th>
2425
<th>Document</th>
26+
<th>Intended level</th>
27+
<th>AD</th>
2528
</tr>
2629
</thead>
27-
<tbody>
2830
{% for state, docs in grouped_docs %}
29-
<tr class="info"><th colspan="3">{{ state.name }}</th></tr>
30-
31+
<tbody>
32+
<tr class="info"><th colspan="5">{{ state.name }}</th></tr>
33+
</tbody>
34+
<tbody>
3135
{% for doc in docs %}
3236
<tr>
3337
<td class="text-nowrap">{% if doc.area_acronym %}{{ doc.area_acronym }}{% endif %}</td>
@@ -40,17 +44,22 @@ <h1>{{ title }}</h1>
4044
</td>
4145

4246
<td>
43-
<b>{{ doc.title }}</b> ({{ doc.intended_std_level.name }})
44-
<br><a href="{% url "doc_view" doc.name %}">{{ doc.name }}</a>
45-
<br>AD: <a href="mailto:{{ doc.ad.email_address|urlencode }}">{{ doc.ad.plain_name }}</a>
47+
<a href="{% url "doc_view" doc.name %}">{{ doc.name }}</a>
48+
<br><b>{{ doc.title }}</b>
4649
{% if doc.note %}
4750
<br><i>Note: {{ doc.note|linebreaksbr|urlize }}</i>
4851
{% endif %}
4952
</td>
53+
<td>{{ doc.intended_std_level.name }}</td>
54+
<td><a href="mailto:{{ doc.ad.email_address|urlencode }}">{{ doc.ad.plain_name }}</a></td>
5055
</tr>
5156
{% endfor %}
52-
{% endfor %}
5357
</tbody>
58+
{% endfor %}
5459
</table>
5560

5661
{% endblock %}
62+
63+
{% block js %}
64+
<script src="{% static "jquery.tablesorter/js/jquery.tablesorter.combined.min.js" %}"></script>
65+
{% endblock %}

ietf/templates/doc/drafts_in_last_call.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{% extends "base.html" %}
22
{# Copyright The IETF Trust 2015, All Rights Reserved #}
3-
{% load origin %}
3+
{% load origin staticfiles %}
4+
5+
{% block pagehead %}
6+
<link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}">
7+
{% endblock %}
48

59
{% block title %}Internet-Drafts in IETF last call{% endblock %}
610

@@ -11,3 +15,7 @@ <h1>Internet-Drafts in IETF last call</h1>
1115
{% include "doc/search/search_results.html" %}
1216

1317
{% endblock %}
18+
19+
{% block js %}
20+
<script src="{% static "jquery.tablesorter/js/jquery.tablesorter.combined.min.js" %}"></script>
21+
{% endblock %}

ietf/templates/doc/search/search.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{% extends "base.html" %}
22
{# Copyright The IETF Trust 2015, All Rights Reserved #}
3-
{% load origin %}
3+
{% load origin staticfiles %}
44

55
{% block title %}Document Search{% endblock %}
66

7+
{% block pagehead %}
8+
<link rel="stylesheet" href="{% static "jquery.tablesorter/css/theme.bootstrap.min.css" %}">
9+
{% endblock %}
10+
711
{% block content %}
812
{% origin %}
913
<h1>Document Search</h1>
@@ -14,3 +18,7 @@ <h1>Document Search</h1>
1418
{% include "doc/search/search_results.html" %}
1519
{% endif %}
1620
{% endblock content %}
21+
22+
{% block js %}
23+
<script src="{% static "jquery.tablesorter/js/jquery.tablesorter.combined.min.js" %}"></script>
24+
{% endblock %}

ietf/templates/doc/search/search_results.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
</div>
1414
{% endif %}
1515

16-
<table class="table table-condensed table-striped">
16+
<table class="table table-condensed table-striped tablesorter">
1717
<thead>
1818
<tr>
19-
<th></th>
19+
<th class="sorter-false"></th>
2020

2121
{% for h in meta.headers %}
2222
{% if h.title != "Title" %}
23-
<th class="{{ h.key }}">
23+
<th data-header="{{ h.key }}">
2424
{% if "sort_url" in h %}
2525
<a href="{{ h.sort_url }}">{{ h.title }}
2626
{% if h.sorted %}<span class="fa fa-caret-down"></span>{% endif %}
@@ -36,15 +36,21 @@
3636

3737
{% regroup docs by search_heading as grouped_docs %}
3838

39-
<tbody>
4039
{% for doc_group in grouped_docs %}
40+
<tbody>
4141
<tr class="info">
4242
<th></th>
43-
<th colspan="{{ meta.headers|length|add:"-1" }}">
43+
{% if "ad" in meta.headers %}
44+
<th colspan="{{ meta.headers|length|add:"-1" }}">
45+
{% else %}
46+
<th colspan="{{ meta.headers|length }}">
47+
{% endif %}
4448
{{ doc_group.grouper|plural:doc_group.list }}
4549
</th>
4650
</tr>
51+
</tbody>
4752

53+
<tbody>
4854
{% for doc in doc_group.list %}
4955
{% include "doc/search/search_result_row.html" %}
5056
{% endfor %}

0 commit comments

Comments
 (0)