Skip to content

Commit 408f45a

Browse files
committed
Template fixes, and changes needed to fix templates.
- Legacy-Id: 19642
1 parent 868f583 commit 408f45a

16 files changed

Lines changed: 654 additions & 696 deletions

File tree

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ module.exports = {
1414
},
1515
globals: {
1616
d3: true
17+
},
18+
parserOptions: {
19+
sourceType: "module",
20+
ecmaVersion: 2015
1721
}
1822
};

ietf/static/css/ietf.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ $enable-negative-margins: true;
3333
@import "~/node_modules/bootstrap/scss/card";
3434
@import "~/node_modules/bootstrap/scss/accordion";
3535
// @import "~/node_modules/bootstrap/scss/breadcrumb";
36-
// @import "~/node_modules/bootstrap/scss/pagination";
36+
@import "~/node_modules/bootstrap/scss/pagination";
3737
@import "~/node_modules/bootstrap/scss/badge";
38-
// @import "~/node_modules/bootstrap/scss/alert";
38+
@import "~/node_modules/bootstrap/scss/alert";
3939
// @import "~/node_modules/bootstrap/scss/progress";
4040
// @import "~/node_modules/bootstrap/scss/list-group";
41-
// @import "~/node_modules/bootstrap/scss/close";
41+
@import "~/node_modules/bootstrap/scss/close";
4242
// @import "~/node_modules/bootstrap/scss/toasts";
43-
// @import "~/node_modules/bootstrap/scss/modal";
44-
// @import "~/node_modules/bootstrap/scss/tooltip";
43+
@import "~/node_modules/bootstrap/scss/modal";
44+
@import "~/node_modules/bootstrap/scss/tooltip";
4545
// @import "~/node_modules/bootstrap/scss/popover";
4646
// @import "~/node_modules/bootstrap/scss/carousel";
47-
// @import "~/node_modules/bootstrap/scss/spinners";
47+
@import "~/node_modules/bootstrap/scss/spinners";
4848
// @import "~/node_modules/bootstrap/scss/offcanvas";
4949
// @import "~/node_modules/bootstrap/scss/placeholders";
5050

ietf/static/js/ietf.js

Lines changed: 64 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// Only import what we need:
22
// https://getbootstrap.com/docs/5.1/customize/optimize/
33

4-
// import "bootstrap/js/dist/alert";
4+
import "bootstrap/js/dist/alert";
55
import "bootstrap/js/dist/button";
66
// import "bootstrap/js/dist/carousel";
77
import "bootstrap/js/dist/collapse";
88
import "bootstrap/js/dist/dropdown";
9-
// import "bootstrap/js/dist/modal";
9+
import "bootstrap/js/dist/modal";
1010
// import "bootstrap/js/dist/offcanvas";
1111
// import "bootstrap/js/dist/popover";
1212
// import "bootstrap/js/dist/scrollspy";
1313
import "bootstrap/js/dist/tab";
1414
// import "bootstrap/js/dist/toast";
15-
// import "bootstrap/js/dist/tooltip";
15+
import "bootstrap/js/dist/tooltip";
1616

1717
import jquery from "jquery"
1818

@@ -29,6 +29,7 @@ function csrfSafeMethod(method) {
2929
// these HTTP methods do not require CSRF protection
3030
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
3131
}
32+
3233
jQuery.ajaxSetup({
3334
crossDomain: false, // obviates need for sameOrigin test
3435
beforeSend: function (xhr, settings) {
@@ -38,59 +39,63 @@ jQuery.ajaxSetup({
3839
}
3940
});
4041

41-
function dropdown_hover() {
42-
var navbar = $(this)
43-
.closest(".navbar");
44-
if (navbar.length === 0 || navbar.find(".navbar-toggler")
45-
.is(":hidden")) {
46-
$(this)
47-
.children(".dropdown-toggle")
48-
.dropdown("toggle");
49-
}
50-
}
51-
52-
if (!("ontouchstart" in document.documentElement)) {
53-
$("ul.nav li.dropdown, ul.nav li.dropend")
54-
.on("mouseenter mouseleave", dropdown_hover);
55-
}
42+
$(document)
43+
.ready(function () {
5644

57-
// load data for the menu
58-
$.ajax({
59-
url: $(document.body)
60-
.data("group-menu-data-url"),
61-
type: "GET",
62-
dataType: "json",
63-
success: function (data) {
64-
for (var parentId in data) {
65-
var attachTo = $(".group-menu.group-parent-" + parentId);
66-
if (attachTo.length == 0) {
67-
console.log("Could not find parent " + parentId);
68-
continue;
45+
function dropdown_hover() {
46+
var navbar = $(this)
47+
.closest(".navbar");
48+
if (navbar.length === 0 || navbar.find(".navbar-toggler")
49+
.is(":hidden")) {
50+
$(this)
51+
.children(".dropdown-toggle")
52+
.dropdown("toggle");
6953
}
70-
attachTo.find(".dropdown-menu")
71-
.remove();
72-
var menu = ['<ul class="dropdown-menu ms-n1">'];
73-
var groups = data[parentId];
74-
var gtype = "";
75-
for (var i = 0; i < groups.length; ++i) {
76-
var g = groups[i];
77-
if (g.type != gtype) {
78-
if (i > 0)
79-
menu.push('<li class="dropdown-divider"></li>');
80-
menu.push('<li class="dropdown-header">' + g.type + 's</li>');
81-
gtype = g.type;
54+
}
55+
56+
// load data for the menu
57+
$.ajax({
58+
url: $(document.body)
59+
.data("group-menu-data-url"),
60+
type: "GET",
61+
dataType: "json",
62+
success: function (data) {
63+
for (var parentId in data) {
64+
var attachTo = $(".group-menu.group-parent-" + parentId);
65+
if (attachTo.length == 0) {
66+
console.log("Could not find parent " + parentId);
67+
continue;
68+
}
69+
attachTo.find(".dropdown-menu")
70+
.remove();
71+
var menu = ['<ul class="dropdown-menu ms-n1">'];
72+
var groups = data[parentId];
73+
var gtype = "";
74+
for (var i = 0; i < groups.length; ++i) {
75+
var g = groups[i];
76+
if (g.type != gtype) {
77+
if (i > 0)
78+
menu.push('<li class="dropdown-divider"></li>');
79+
menu.push('<li class="dropdown-header">' + g.type + "s</li>");
80+
gtype = g.type;
81+
}
82+
menu.push('<li><a class="dropdown-item" href="' + g.url + '">' +
83+
g.acronym + " &mdash; " + g.name + "</a></li>");
84+
}
85+
menu.push("</ul>");
86+
for (i = 0; i < attachTo.length; i++) {
87+
attachTo.closest(".dropdown-menu");
88+
}
89+
attachTo.append(menu.join(""));
8290
}
83-
menu.push('<li><a class="dropdown-item" href="' + g.url + '">' +
84-
g.acronym + ' &mdash; ' + g.name + '</a></li>');
85-
}
86-
menu.push("</ul>");
87-
for (var i = 0; i < attachTo.length; i++) {
88-
attachTo.closest(".dropdown-menu");
8991
}
90-
attachTo.append(menu.join(""));
92+
});
93+
94+
if (!("ontouchstart" in document.documentElement)) {
95+
$("ul.nav li.dropdown, ul.nav li.dropend")
96+
.on("mouseenter mouseleave", dropdown_hover);
9197
}
92-
}
93-
});
98+
});
9499

95100
// This used to be in doc-search.js; consolidate all JS in one file.
96101
$(document)
@@ -172,15 +177,15 @@ $(document)
172177
updateAdvanced();
173178
}
174179

175-
$('.review-wish-add-remove-doc.ajax, .track-untrack-doc')
180+
$(".review-wish-add-remove-doc.ajax, .track-untrack-doc")
176181
.on("click", function (e) {
177182
e.preventDefault();
178183
var trigger = $(this);
179184
$.ajax({
180-
url: trigger.attr('href'),
181-
type: 'POST',
185+
url: trigger.attr("href"),
186+
type: "POST",
182187
cache: false,
183-
dataType: 'json',
188+
dataType: "json",
184189
success: function (response) {
185190
if (response.success) {
186191
trigger.parent()
@@ -189,12 +194,11 @@ $(document)
189194
trigger.attr("hidden", true);
190195

191196
var target_unhide = null;
192-
if (trigger.hasClass('review-wish-add-remove-doc')) {
193-
target_unhide = '.review-wish-add-remove-doc';
194-
} else if (trigger.hasClass('track-untrack-doc')) {
195-
target_unhide = '.track-untrack-doc';
197+
if (trigger.hasClass("review-wish-add-remove-doc")) {
198+
target_unhide = ".review-wish-add-remove-doc";
199+
} else if (trigger.hasClass("track-untrack-doc")) {
200+
target_unhide = ".track-untrack-doc";
196201
}
197-
if (target_unhide) {}
198202
trigger.parent()
199203
.find(target_unhide)
200204
.not(trigger)
@@ -203,5 +207,4 @@ $(document)
203207
}
204208
});
205209
});
206-
207210
});

ietf/templates/base.html

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<link rel="stylesheet" href="{% static 'ietf/css/ietf.css' %}"/>
2121
<style>
2222
{% block morecss %}{% endblock morecss %}
23+
.leftmenu { width: 13em; }
2324
</style>
2425

2526
{% block pagehead %}{% endblock pagehead %}
@@ -64,29 +65,29 @@
6465
</nav>
6566

6667
<div class="pt-3 container-fluid">
67-
{% comment %} {% bootstrap_messages %} {% endcomment %}
68-
{% for message in messages %}
69-
<div class="alert{% if message.level_tag %} alert-{% if message.level_tag == 'error' %}danger{% else %}{{ message.level_tag }}{% endif %}{% endif %}{% if message.extra_tags %} {{ message.extra_tags }}{% endif %} alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&#215;</button>{{ message }}</div>
70-
{% endfor %}
71-
{% if request.COOKIES.left_menu == "on" and not hide_menu %}
72-
{# ugly hack for the more or less unported meeting agenda edit pages #}
73-
<div class="row">
74-
<div class="d-none d-md-block border-end lh-sm leftmenu small" style="width: 13em;">
68+
<div class="row">
69+
{% if request.COOKIES.left_menu == "on" and not hide_menu %}
70+
<div class="col-1 d-none d-md-block border-end lh-sm leftmenu small">
7571
<ul class="nav nav-pills flex-column">
7672
{% include "base/menu.html" with flavor="left" %}
7773
</ul>
7874
</div>
79-
{% endif %}
80-
<div class="col" id="content">
81-
{% block content %}{{ content|safe }}{% endblock content %}
82-
{% block content_end %}{% endblock content_end %}
83-
</div>
84-
{% if request.COOKIES.left_menu == "on" and not hide_menu %}
75+
{% endif %}
76+
<div class="col" id="content">
77+
{% comment %} {% bootstrap_messages %} {% endcomment %}
78+
{% for message in messages %}
79+
<div class="alert{% if message.level_tag %} alert-{% if message.level_tag == 'error' %}danger{% else %}{{ message.level_tag }}{% endif %}{% endif %}{% if message.extra_tags %} {{ message.extra_tags }}{% endif %} alert-dismissable fade show">
80+
<button type="button" class="btn-close float-end" data-bs-dismiss="alert" aria-label="Close"></button>
81+
{{ message }}
82+
</div>
83+
{% endfor %}
84+
{% block content %}{{ content|safe }}{% endblock content %}
85+
{% block content_end %}{% endblock content_end %}
8586
</div>
86-
{% endif %}
87+
</div>
88+
<hr/>
8789
{% block footer %}
8890
<footer class="col-md-12 col-sm-12 text-center">
89-
<hr/>
9091
<a href="https://www.ietf.org/" class="p-3">IETF</a>
9192
<a href="https://www.ietf.org/iesg/" class="p-3">IESG</a>
9293
<a href="https://www.iab.org/" class="p-3">IAB</a>
Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
{% extends "base.html" %}
21
{# Copyright The IETF Trust 2015, All Rights Reserved #}
2+
3+
{% extends "base.html" %}
34
{% load origin %}
45

5-
{% block title %}User settings{% endblock %}
6+
{% block title %}User settings{% endblock title %}
67

78
{% block content %}
89
{% origin %}
@@ -15,51 +16,47 @@ <h1>User settings</h1>
1516
(everything still continues to work by using default settings).
1617
</p>
1718

18-
<h2>How many days is considered "new"?</h2>
19+
<h3>How many days is considered "new"?</h3>
1920

2021
<p>This setting affects how many days are considered "new enough" to get the special highlighting in the documents table. The default setting is {{ defaults.new_enough }} days.</p>
2122

22-
<div class="btn-group btn-group-justified">
23-
<a class="btn btn-primary {% if new_enough == '7' %}active{% endif %}" href="/accounts/settings/new_enough/7">7 days</a>
24-
<a class="btn btn-primary {% if new_enough == '14' %}active{% endif %}" href="/accounts/settings/new_enough/14">14 days</a>
25-
<a class="btn btn-primary {% if new_enough == '21' %}active{% endif %}" href="/accounts/settings/new_enough/21">21 days</a>
26-
<a class="btn btn-primary {% if new_enough == '30' %}active{% endif %}" href="/accounts/settings/new_enough/30">30 days</a>
27-
<a class="btn btn-primary {% if new_enough == '60' %}active{% endif %}" href="/accounts/settings/new_enough/60">60 days</a>
28-
<a class="btn btn-primary {% if new_enough == '90' %}active{% endif %}" href="/accounts/settings/new_enough/90">90 days</a>
29-
</div>
23+
<p class="btn-group d-flex">
24+
<a class="btn btn-outline-primary {% if new_enough == '7' %}active{% endif %}" href="/accounts/settings/new_enough/7">7 days</a>
25+
<a class="btn btn-outline-primary {% if new_enough == '14' %}active{% endif %}" href="/accounts/settings/new_enough/14">14 days</a>
26+
<a class="btn btn-outline-primary {% if new_enough == '21' %}active{% endif %}" href="/accounts/settings/new_enough/21">21 days</a>
27+
<a class="btn btn-outline-primary {% if new_enough == '30' %}active{% endif %}" href="/accounts/settings/new_enough/30">30 days</a>
28+
<a class="btn btn-outline-primary {% if new_enough == '60' %}active{% endif %}" href="/accounts/settings/new_enough/60">60 days</a>
29+
<a class="btn btn-outline-primary {% if new_enough == '90' %}active{% endif %}" href="/accounts/settings/new_enough/90">90 days</a>
30+
</p>
3031

31-
<h2 class="ietf-divider">How many days is considered "soon"?</h2>
32+
<h3>How many days is considered "soon"?</h3>
3233

3334
<p>This setting tells what is considered "soon" when showing documents that are going to be expire soon. The Default setting is {{ defaults.expires_soon }} days.</p>
3435

35-
<div class="btn-group btn-group-justified">
36-
<a class="btn btn-primary {% if expires_soon == '7' %}active{% endif %}" href="/accounts/settings/expires_soon/7">7 days</a>
37-
<a class="btn btn-primary {% if expires_soon == '14' %}active{% endif %}" href="/accounts/settings/expires_soon/14">14 days</a>
38-
<a class="btn btn-primary {% if expires_soon == '21' %}active{% endif %}" href="/accounts/settings/expires_soon/21">21 days</a>
39-
<a class="btn btn-primary {% if expires_soon == '30' %}active{% endif %}" href="/accounts/settings/expires_soon/30">30 days</a>
40-
<a class="btn btn-primary {% if expires_soon == '60' %}active{% endif %}" href="/accounts/settings/expires_soon/60">60 days</a>
41-
<a class="btn btn-primary {% if expires_soon == '90' %}active{% endif %}" href="/accounts/settings/expires_soon/90">90 days</a>
42-
</div>
36+
<p class="btn-group d-flex">
37+
<a class="btn btn-outline-primary {% if expires_soon == '7' %}active{% endif %}" href="/accounts/settings/expires_soon/7">7 days</a>
38+
<a class="btn btn-outline-primary {% if expires_soon == '14' %}active{% endif %}" href="/accounts/settings/expires_soon/14">14 days</a>
39+
<a class="btn btn-outline-primary {% if expires_soon == '21' %}active{% endif %}" href="/accounts/settings/expires_soon/21">21 days</a>
40+
<a class="btn btn-outline-primary {% if expires_soon == '30' %}active{% endif %}" href="/accounts/settings/expires_soon/30">30 days</a>
41+
<a class="btn btn-outline-primary {% if expires_soon == '60' %}active{% endif %}" href="/accounts/settings/expires_soon/60">60 days</a>
42+
<a class="btn btn-outline-primary {% if expires_soon == '90' %}active{% endif %}" href="/accounts/settings/expires_soon/90">90 days</a>
43+
</p>
4344

44-
<h2 class="ietf-divider">Show full document text by default?</h2>
45+
<h3>Show full document text by default?</h3>
4546

4647
<p>Show the full text immediately on the document page instead of only showing beginning of it. This defaults to {{ defaults.full_draft }}.</p>
4748

48-
<div class="btn-group btn-group-justified">
49-
<a class="btn btn-primary {% if full_draft == 'off' %}active{% endif %}" href="/accounts/settings/full_draft/off">Off</a>
50-
<a class="btn btn-primary {% if full_draft == 'on' %}active{% endif %}" href="/accounts/settings/full_draft/on">On</a>
51-
</div>
49+
<p class="btn-group d-flex">
50+
<a class="btn btn-outline-primary {% if full_draft == 'off' %}active{% endif %}" href="/accounts/settings/full_draft/off">Off</a>
51+
<a class="btn btn-outline-primary {% if full_draft == 'on' %}active{% endif %}" href="/accounts/settings/full_draft/on">On</a>
52+
</p>
5253

53-
<h2 class="ietf-divider">Show the left-hand menu?</h2>
54+
<h3>Show the left-hand menu?</h3>
5455

5556
<p>Show the left-hand menu on all regular pages? This defaults to {{ defaults.left_menu }}.</p>
5657

57-
<div class="btn-group btn-group-justified">
58-
<a class="btn btn-primary {% if left_menu == 'off' %}active{% endif %}" href="/accounts/settings/left_menu/off">Off</a>
59-
<a class="btn btn-primary {% if left_menu == 'on' %}active{% endif %}" href="/accounts/settings/left_menu/on">On</a>
60-
</div>
61-
62-
63-
64-
{% endblock %}
65-
58+
<p class="btn-group d-flex">
59+
<a class="btn btn-outline-primary {% if left_menu == 'off' %}active{% endif %}" href="/accounts/settings/left_menu/off">Off</a>
60+
<a class="btn btn-outline-primary {% if left_menu == 'on' %}active{% endif %}" href="/accounts/settings/left_menu/on">On</a>
61+
</p>
62+
{% endblock content %}

ietf/templates/doc/search/search_form.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{ form.name|add_class:"form-control"|attr:"placeholder:Document name/title/RFC number" }}
1212
<span class="input-group-btn">
1313
<button class="btn btn-primary" type="submit">
14-
<span class="bi bi-search"></span>
14+
<span class="bi bi-search"/>
1515
Search
1616
</button>
1717
</span>
@@ -151,7 +151,7 @@ <h2 class="accordion-header" id="search-heading">
151151
</div>
152152
<div class="col-sm-4 d-grid">
153153
<button class="btn btn-primary" type="submit">
154-
<span class="bi bi-search"></span>
154+
<span class="bi bi-search"/>
155155
Search
156156
</button>
157157
</div>

0 commit comments

Comments
 (0)