1.1 --- a/htdocs/styles.css Fri Jan 30 18:24:43 2015 +0100
1.2 +++ b/htdocs/styles.css Fri Jan 30 19:37:27 2015 +0100
1.3 @@ -49,6 +49,8 @@
1.4 color: #009;
1.5 }
1.6
1.7 +/* Selection of slots/periods for new events. */
1.8 +
1.9 input.newevent {
1.10 display: none;
1.11 }
1.12 @@ -76,3 +78,21 @@
1.13 background-color: #af8;
1.14 text-decoration: underline;
1.15 }
1.16 +
1.17 +/* Hiding/showing unused slots/periods. */
1.18 +
1.19 +input#hideslots {
1.20 + display: none;
1.21 +}
1.22 +
1.23 +input#hideslots:checked ~ p label.enable[for=hideslots] {
1.24 + display: none;
1.25 +}
1.26 +
1.27 +input#hideslots:not(:checked) ~ p label.disable[for=hideslots] {
1.28 + display: none;
1.29 +}
1.30 +
1.31 +input#hideslots:checked ~ table tr.slot.daystart.empty {
1.32 + display: none;
1.33 +}
2.1 --- a/imip_manager.py Fri Jan 30 18:24:43 2015 +0100
2.2 +++ b/imip_manager.py Fri Jan 30 19:37:27 2015 +0100
2.3 @@ -618,6 +618,16 @@
2.4 page.input(name="newevent", type="submit", value="New event", id="newevent")
2.5 page.p.close()
2.6
2.7 + # Show a control for hiding empty slots.
2.8 + # The positioning of the control, paragraph and table are important here.
2.9 +
2.10 + page.input(name="hideslots", type="checkbox", value="hide", id="hideslots")
2.11 +
2.12 + page.p()
2.13 + page.label("Hide unused time periods", for_="hideslots", class_="enable")
2.14 + page.label("Show unused time periods", for_="hideslots", class_="disable")
2.15 + page.p.close()
2.16 +
2.17 freebusy = self.store.get_freebusy(self.user)
2.18
2.19 if not freebusy:
2.20 @@ -817,7 +827,7 @@
2.21
2.22 page = self.page
2.23
2.24 - # Produce a row for each time point.
2.25 + # Produce a row for each interval.
2.26
2.27 intervals = list(intervals)
2.28 intervals.sort()
2.29 @@ -825,7 +835,17 @@
2.30 for point, endpoint in intervals:
2.31 continuation = point == get_start_of_day(point)
2.32
2.33 - page.tr()
2.34 + # Some rows contain no period details and are marked as such.
2.35 +
2.36 + have_active = reduce(lambda x, y: x or y, [slots.get(point) for slots in groups], None)
2.37 +
2.38 + css = " ".join(
2.39 + ["slot"] +
2.40 + (not have_active and ["empty"] or []) +
2.41 + (continuation and ["daystart"] or [])
2.42 + )
2.43 +
2.44 + page.tr(class_=css)
2.45 page.th(class_="timeslot")
2.46 self._time_point(point, endpoint)
2.47 page.th.close()