1.1 --- a/imip_manager.py Fri Jan 30 18:24:43 2015 +0100
1.2 +++ b/imip_manager.py Fri Jan 30 19:37:27 2015 +0100
1.3 @@ -618,6 +618,16 @@
1.4 page.input(name="newevent", type="submit", value="New event", id="newevent")
1.5 page.p.close()
1.6
1.7 + # Show a control for hiding empty slots.
1.8 + # The positioning of the control, paragraph and table are important here.
1.9 +
1.10 + page.input(name="hideslots", type="checkbox", value="hide", id="hideslots")
1.11 +
1.12 + page.p()
1.13 + page.label("Hide unused time periods", for_="hideslots", class_="enable")
1.14 + page.label("Show unused time periods", for_="hideslots", class_="disable")
1.15 + page.p.close()
1.16 +
1.17 freebusy = self.store.get_freebusy(self.user)
1.18
1.19 if not freebusy:
1.20 @@ -817,7 +827,7 @@
1.21
1.22 page = self.page
1.23
1.24 - # Produce a row for each time point.
1.25 + # Produce a row for each interval.
1.26
1.27 intervals = list(intervals)
1.28 intervals.sort()
1.29 @@ -825,7 +835,17 @@
1.30 for point, endpoint in intervals:
1.31 continuation = point == get_start_of_day(point)
1.32
1.33 - page.tr()
1.34 + # Some rows contain no period details and are marked as such.
1.35 +
1.36 + have_active = reduce(lambda x, y: x or y, [slots.get(point) for slots in groups], None)
1.37 +
1.38 + css = " ".join(
1.39 + ["slot"] +
1.40 + (not have_active and ["empty"] or []) +
1.41 + (continuation and ["daystart"] or [])
1.42 + )
1.43 +
1.44 + page.tr(class_=css)
1.45 page.th(class_="timeslot")
1.46 self._time_point(point, endpoint)
1.47 page.th.close()