Skip to content

Commit 6e3460e

Browse files
committed
Merged in [18940] from jennifer@painless-security.com:
Hide agenda timeslot label rows when all their sessions are hidden. Fixes ietf-tools#3249. - Legacy-Id: 18949 Note: SVN reference [18940] has been migrated to Git commit 49779a3
2 parents 6d7a0b6 + 49779a3 commit 6e3460e

2 files changed

Lines changed: 72 additions & 1 deletion

File tree

ietf/meeting/tests_js.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,60 @@ def get_agenda_filter_group_button(wait, group_acronym):
616616
)
617617
)
618618

619+
def test_agenda_timeslot_label_visibility(self):
620+
"""The timeslot label for regular sessions should only be shown when a session is visible"""
621+
wait = WebDriverWait(self.driver, 2)
622+
url = self.absreverse('ietf.meeting.views.agenda')
623+
mars_assignments = self.meeting.schedule.assignments.filter(session__group__acronym='mars')
624+
ames_assignments = self.meeting.schedule.assignments.filter(session__group__acronym='ames')
625+
assert(mars_assignments.count() == 1) # if not, need to update test
626+
assert(ames_assignments.count() == 1) # if not, need to update test
627+
assignments = dict(
628+
mars=mars_assignments.first(),
629+
ames=ames_assignments.first(),
630+
)
631+
# test relies on these timeslots being different so they will have separate label rows
632+
assert(assignments['mars'].timeslot.time != assignments['ames'].timeslot.time)
633+
label_row_selectors = {
634+
grp: (By.CSS_SELECTOR, 'tr.session-label-row[data-slot-start-ts="{}"][data-slot-end-ts="{}"]'.format(
635+
int(assignment.timeslot.utc_start_time().timestamp()),
636+
int(assignment.timeslot.utc_end_time().timestamp()),
637+
))
638+
for grp, assignment in assignments.items()
639+
}
640+
641+
self.login()
642+
643+
# get page with all items visible
644+
self.driver.get(url)
645+
wait.until(expected_conditions.visibility_of_element_located(label_row_selectors['ames']))
646+
wait.until(expected_conditions.visibility_of_element_located(label_row_selectors['mars']))
647+
648+
# get page with ames hidden
649+
self.driver.get(url + '?show=mars&hide=ames')
650+
wait.until(expected_conditions.invisibility_of_element_located(label_row_selectors['ames']))
651+
wait.until(expected_conditions.visibility_of_element_located(label_row_selectors['mars']))
652+
653+
# get page with mars hidden
654+
self.driver.get(url + '?show=ames&hide=mars')
655+
wait.until(expected_conditions.visibility_of_element_located(label_row_selectors['ames']))
656+
wait.until(expected_conditions.invisibility_of_element_located(label_row_selectors['mars']))
657+
658+
# create an ames session in the mars timeslot, should cause the mars timeslot label to reappear
659+
sess = SessionFactory(group=Group.objects.get(acronym='ames'),
660+
meeting=self.meeting,
661+
add_to_schedule=False)
662+
sess.timeslotassignments.create(timeslot=assignments['mars'].timeslot,
663+
schedule=self.meeting.schedule)
664+
self.driver.get(url + '?show=ames&hide=mars')
665+
wait.until(expected_conditions.visibility_of_element_located(label_row_selectors['ames']))
666+
wait.until(expected_conditions.visibility_of_element_located(label_row_selectors['mars']))
667+
668+
# get page with ames and mars hidden
669+
self.driver.get(url + '?hide=ames,mars')
670+
wait.until(expected_conditions.invisibility_of_element_located(label_row_selectors['ames']))
671+
wait.until(expected_conditions.invisibility_of_element_located(label_row_selectors['mars']))
672+
619673
def test_agenda_view_group_filter_toggle(self):
620674
"""Clicking a group toggle enables/disables agenda filtering"""
621675
wait = WebDriverWait(self.driver, 2)

ietf/templates/meeting/agenda.html

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ <h2>
145145

146146
{% if item.timeslot.type_id == 'regular' %}
147147
{% ifchanged %}
148-
<tr class="info"
148+
<tr class="info session-label-row"
149149
data-slot-start-ts="{{item.start_timestamp}}"
150150
data-slot-end-ts="{{item.end_timestamp}}">
151151
<td class="leftmarker"></td>
@@ -402,6 +402,23 @@ <h2>
402402
// this is a "negative" item by wg: when present, hide these rows
403403
agenda_filter.rows_matching_filter_keyword(agenda_rows, v).hide();
404404
});
405+
406+
// Now hide any session label rows with no visible sessions. Identify
407+
// by matching on start/end timestamps.
408+
$('tr.session-label-row').each(function(i, e) {
409+
var start_ts = $(e).attr('data-slot-start-ts');
410+
var end_ts = $(e).attr('data-slot-end-ts');
411+
var visible_rows = agenda_rows.filter(
412+
'[data-slot-start-ts="' + start_ts + '"]' +
413+
'[data-slot-end-ts="' + end_ts + '"]' +
414+
':visible'
415+
);
416+
if (visible_rows.length > 0) {
417+
$(e).show();
418+
} else {
419+
$(e).hide();
420+
}
421+
})
405422
}
406423

407424
function update_ical_links(filter_params) {

0 commit comments

Comments
 (0)