Skip to content

Commit e195a00

Browse files
committed
And more agenda fixes.
- Legacy-Id: 19682
1 parent 5772701 commit e195a00

10 files changed

Lines changed: 271 additions & 570 deletions

File tree

ietf/meeting/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,7 @@ def agenda(request, num=None, name=None, base=None, ext=None, owner=None, utc=""
15301530
is_current_meeting = (num is None) or (num == get_current_ietf_meeting_num())
15311531

15321532
rendered_page = render(request, "meeting/"+base+ext, {
1533+
"personalize": False,
15331534
"schedule": schedule,
15341535
"filtered_assignments": filtered_assignments,
15351536
"updated": updated,
@@ -1701,8 +1702,9 @@ def agenda_personalize(request, num):
17011702

17021703
return render(
17031704
request,
1704-
"meeting/agenda_personalize.html",
1705+
"meeting/agenda.html",
17051706
{
1707+
'personalize': True,
17061708
'schedule': meeting.schedule,
17071709
'updated': meeting.updated(),
17081710
'filtered_assignments': filtered_assignments,
@@ -4161,4 +4163,4 @@ def approve_proposed_slides(request, slidesubmission_id, num):
41614163
'session_number': session_number,
41624164
'existing_doc' : existing_doc,
41634165
'form': form,
4164-
})
4166+
})

ietf/static/js/agenda_filter.js

Lines changed: 81 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
33

44
// closure to create private scope
55
(function () {
6-
'use strict'
6+
'use strict';
77

88
/* n.b., const refers to the opts object itself, not its contents.
99
* Use camelCase for easy translation into element.dataset keys,
@@ -15,74 +15,79 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
1515
};
1616

1717
/* Remove from list, if present */
18-
function remove_list_item (list, item) {
18+
function remove_list_item(list, item) {
1919
var item_index = list.indexOf(item);
2020
if (item_index !== -1) {
21-
list.splice(item_index, 1)
21+
list.splice(item_index, 1);
2222
}
2323
}
2424

2525
/* Add to list if not present, remove if present
2626
*
2727
* Returns true if added to the list, otherwise false.
2828
*/
29-
function toggle_list_item (list, item) {
29+
function toggle_list_item(list, item) {
3030
var item_index = list.indexOf(item);
3131
if (item_index === -1) {
32-
list.push(item)
32+
list.push(item);
3333
return true;
3434
} else {
35-
list.splice(item_index, 1)
35+
list.splice(item_index, 1);
3636
return false;
3737
}
3838
}
3939

40-
function parse_query_params (qs) {
41-
var params = {}
42-
qs = decodeURI(qs).replace(/^\?/, '').toLowerCase()
40+
function parse_query_params(qs) {
41+
var params = {};
42+
qs = decodeURI(qs)
43+
.replace(/^\?/, '')
44+
.toLowerCase();
4345
if (qs) {
44-
var param_strs = qs.split('&')
46+
var param_strs = qs.split('&');
4547
for (var ii = 0; ii < param_strs.length; ii++) {
46-
var toks = param_strs[ii].split('=', 2)
47-
params[toks[0]] = toks[1] || true
48+
var toks = param_strs[ii].split('=', 2);
49+
params[toks[0]] = toks[1] || true;
4850
}
4951
}
50-
return params
52+
return params;
5153
}
5254

5355
/* filt = 'show' or 'hide' */
54-
function get_filter_from_qparams (qparams, filt) {
56+
function get_filter_from_qparams(qparams, filt) {
5557
if (!qparams[filt] || (qparams[filt] === true)) {
5658
return [];
5759
}
5860
var result = [];
5961
var qp = qparams[filt].split(',');
60-
62+
6163
for (var ii = 0; ii < qp.length; ii++) {
6264
result.push(qp[ii].trim());
6365
}
6466
return result;
6567
}
6668

67-
function get_filter_params (qparams) {
69+
function get_filter_params(qparams) {
6870
var enabled = opts.alwaysShow || qparams.show || qparams.hide;
6971
return {
7072
enabled: enabled,
7173
show: get_filter_from_qparams(qparams, 'show'),
7274
hide: get_filter_from_qparams(qparams, 'hide')
73-
}
75+
};
7476
}
7577

7678
function get_keywords(elt) {
77-
var keywords = $(elt).attr('data-filter-keywords');
79+
var keywords = $(elt)
80+
.attr('data-filter-keywords');
7881
if (keywords) {
79-
return keywords.toLowerCase().split(',');
82+
return keywords.toLowerCase()
83+
.split(',');
8084
}
8185
return [];
8286
}
8387

8488
function get_item(elt) {
85-
return $(elt).attr('data-filter-item');
89+
return $(elt)
90+
.attr('data-filter-item');
8691
}
8792

8893
// utility method - is there a match between two lists of keywords?
@@ -94,25 +99,27 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
9499
}
95100
return false;
96101
}
97-
102+
98103
// Find the items corresponding to a keyword
99-
function get_items_with_keyword (keyword) {
104+
function get_items_with_keyword(keyword) {
100105
var items = [];
101106

102-
$('.view button.pickview').filter(function(index, elt) {
103-
return keyword_match(get_keywords(elt), [keyword]);
104-
}).each(function (index, elt) {
105-
items.push(get_item($(elt)));
106-
});
107+
$('.view button.pickview')
108+
.filter(function (index, elt) {
109+
return keyword_match(get_keywords(elt), [keyword]);
110+
})
111+
.each(function (index, elt) {
112+
items.push(get_item($(elt)));
113+
});
107114
return items;
108115
}
109116

110-
function filtering_is_enabled (filter_params) {
117+
function filtering_is_enabled(filter_params) {
111118
return filter_params.enabled;
112119
}
113120

114121
// Update the filter / customization UI to match the current filter parameters
115-
function update_filter_ui (filter_params) {
122+
function update_filter_ui(filter_params) {
116123
var buttons = $('.pickview');
117124

118125
if (!filtering_is_enabled(filter_params)) {
@@ -121,12 +128,12 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
121128
return;
122129
}
123130

124-
update_href_querystrings(filter_params_as_querystring(filter_params))
131+
update_href_querystrings(filter_params_as_querystring(filter_params));
125132

126133
// show the customizer - it will stay visible even if filtering is disabled
127134
const customizer = $('#customize');
128135
if (customizer.hasClass('collapse')) {
129-
customizer.collapse('show')
136+
customizer.collapse('show');
130137
}
131138

132139
// Update button state to match visibility
@@ -135,7 +142,7 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
135142
var keywords = get_keywords(elt);
136143
keywords.push(get_item(elt)); // treat item as one of its keywords
137144
var hidden = keyword_match(filter_params.hide, keywords);
138-
var shown = keyword_match(filter_params.show, keywords);
145+
var shown = keyword_match(filter_params.show, keywords);
139146
if (shown && !hidden) {
140147
elt.addClass('active');
141148
} else {
@@ -149,11 +156,11 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
149156
* Calling the individual update_* functions outside of this method will likely cause
150157
* various parts of the page to get out of sync.
151158
*/
152-
function update_view () {
153-
var filter_params = get_filter_params(parse_query_params(window.location.search))
154-
update_filter_ui(filter_params)
159+
function update_view() {
160+
var filter_params = get_filter_params(parse_query_params(window.location.search));
161+
update_filter_ui(filter_params);
155162
if (opts.updateCallback) {
156-
opts.updateCallback(filter_params)
163+
opts.updateCallback(filter_params);
157164
}
158165
}
159166

@@ -162,19 +169,19 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
162169
* Updates the URL to match filter_params, then updates the history / display to match
163170
* (if supported) or loads the new URL.
164171
*/
165-
function update_filters (filter_params) {
172+
function update_filters(filter_params) {
166173
var new_url = replace_querystring(
167-
window.location.href,
168-
filter_params_as_querystring(filter_params)
169-
)
170-
update_href_querystrings(filter_params_as_querystring(filter_params))
174+
window.location.href,
175+
filter_params_as_querystring(filter_params)
176+
);
177+
update_href_querystrings(filter_params_as_querystring(filter_params));
171178
if (window.history && window.history.replaceState) {
172179
// Keep current origin, replace search string, no page reload
173-
history.replaceState({}, document.title, new_url)
174-
update_view()
180+
history.replaceState({}, document.title, new_url);
181+
update_view();
175182
} else {
176183
// No window.history.replaceState support, page reload required
177-
window.location = new_url
184+
window.location = new_url;
178185
}
179186
}
180187

@@ -183,34 +190,35 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
183190
*/
184191
function update_href_querystrings(querystring) {
185192
Array.from(
186-
document.getElementsByClassName('agenda-link filterable')
187-
).forEach(
188-
(elt) => elt.href = replace_querystring(elt.href, querystring)
189-
)
193+
document.getElementsByClassName('agenda-link filterable')
194+
)
195+
.forEach(
196+
(elt) => elt.href = replace_querystring(elt.href, querystring)
197+
);
190198
}
191199

192200
function filter_params_as_querystring(filter_params) {
193-
var qparams = []
201+
var qparams = [];
194202
if (filter_params.show.length > 0) {
195-
qparams.push('show=' + filter_params.show.join())
203+
qparams.push('show=' + filter_params.show.join());
196204
}
197205
if (filter_params.hide.length > 0) {
198-
qparams.push('hide=' + filter_params.hide.join())
206+
qparams.push('hide=' + filter_params.hide.join());
199207
}
200208
if (qparams.length > 0) {
201-
return '?' + qparams.join('&')
209+
return '?' + qparams.join('&');
202210
}
203-
return ''
211+
return '';
204212
}
205213

206214
function replace_querystring(url, new_querystring) {
207-
return url.replace(/(\?.*)?(#.*)?$/, new_querystring + window.location.hash)
215+
return url.replace(/(\?.*)?(#.*)?$/, new_querystring + window.location.hash);
208216
}
209217

210218
/* Helper for pick group/type button handlers - toggles the appropriate parameter entry
211219
* elt - the jquery element that was clicked
212220
*/
213-
function handle_pick_button (elt) {
221+
function handle_pick_button(elt) {
214222
var fp = get_filter_params(parse_query_params(window.location.search));
215223
var item = get_item(elt);
216224

@@ -232,17 +240,17 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
232240
* an area will enable all items in the row as one would expect. */
233241
if (just_showed_item) {
234242
var children = get_items_with_keyword(item);
235-
$.each(children, function(index, child) {
243+
$.each(children, function (index, child) {
236244
remove_list_item(fp.show, child);
237245
remove_list_item(fp.hide, child);
238246
});
239247
}
240-
248+
241249
// If the show list is empty, clear the hide list because there is nothing to hide
242250
if (fp.show.length === 0) {
243251
fp.hide = [];
244252
}
245-
253+
246254
return fp;
247255
}
248256

@@ -251,41 +259,32 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
251259
}
252260

253261
function register_handlers() {
254-
$('.pickview').on("click", function () {
255-
if (is_disabled($(this))) { return; }
256-
var fp = handle_pick_button($(this));
257-
update_filters(fp);
258-
});
259-
}
260-
261-
/**
262-
* Read options from the template
263-
*/
264-
function read_template_options() {
265-
const opts_elt = document.getElementById('agenda-filter-options');
266-
opts.keys().forEach((opt) => {
267-
if (opt in opts_elt.dataset) {
268-
opts[opt] = opts_elt.dataset[opt];
269-
}
270-
});
262+
$('.pickview')
263+
.on("click", function () {
264+
console.log("pickview");
265+
if (is_disabled($(this))) { return; }
266+
var fp = handle_pick_button($(this));
267+
update_filters(fp);
268+
});
271269
}
272270

273271
/* Entry point to filtering code when page loads
274272
*
275273
* This must be called if you are using the HTML template to provide a customization
276274
* button UI. Do not call if you only want to use the parameter parsing routines.
277275
*/
278-
function enable () {
276+
function enable() {
279277
// ready handler fires immediately if document is already "ready"
280-
$(document).ready(function () {
281-
register_handlers();
282-
update_view();
283-
})
278+
$(document)
279+
.ready(function () {
280+
register_handlers();
281+
update_view();
282+
})
284283
}
285284

286285
// utility method - filter a jquery set to those matching a keyword
287286
function rows_matching_filter_keyword(rows, kw) {
288-
return rows.filter(function(index, element) {
287+
return rows.filter(function (index, element) {
289288
var row_kws = get_keywords(element);
290289
return keyword_match(row_kws, [kw.toLowerCase()]);
291290
});
@@ -305,6 +304,6 @@ window.agenda_filter_for_testing; // methods to be accessed for automated testin
305304
keyword_match: keyword_match,
306305
parse_query_params: parse_query_params,
307306
rows_matching_filter_keyword: rows_matching_filter_keyword,
308-
set_update_callback: function (cb) {opts.updateCallback = cb}
307+
set_update_callback: function (cb) { opts.updateCallback = cb }
309308
};
310309
})();

0 commit comments

Comments
 (0)