imip-agent

Changeset

768:26fd43fa7db3
2015-09-26 Paul Boddie raw files shortlog changelog graph Moved id attributes to more appropriate elements. imipweb-client-simplification
imipweb/calendar.py (file)
     1.1 --- a/imipweb/calendar.py	Fri Sep 25 19:36:33 2015 +0200
     1.2 +++ b/imipweb/calendar.py	Sat Sep 26 17:39:20 2015 +0200
     1.3 @@ -443,8 +443,8 @@
     1.4          for day in days:
     1.5              daystr, dayid = self._day_value_and_identifier(day)
     1.6              l.append("""\
     1.7 -input.newevent.selector#%s:checked ~ table label.day.day-%s,
     1.8 -input.newevent.selector#%s:checked ~ table label.timepoint.day-%s""" % (dayid, daystr, dayid, daystr))
     1.9 +input.newevent.selector#%s:checked ~ table thead#region-%s label.day,
    1.10 +input.newevent.selector#%s:checked ~ table tbody#region-%s label.timepoint""" % (dayid, dayid, dayid, dayid))
    1.11  
    1.12          page.add(",\n".join(l))
    1.13          page.add(""" {
    1.14 @@ -478,10 +478,9 @@
    1.15  
    1.16          for day, intervals in days.items():
    1.17              for point, endpoint in intervals:
    1.18 -                daystr, dayid = self._day_value_and_identifier(day)
    1.19                  timestr, timeid = self._slot_value_and_identifier(point, endpoint)
    1.20                  l.append("""\
    1.21 -input.newevent.selector#%s:checked ~ table label.timepoint[for=%s]""" % (timeid, timeid))
    1.22 +input.newevent.selector#%s:checked ~ table th#region-%s label.timepoint""" % (timeid, timeid))
    1.23  
    1.24          page.add(",\n".join(l))
    1.25          page.add(""" {
    1.26 @@ -555,7 +554,9 @@
    1.27                          is_empty = False
    1.28                          break
    1.29  
    1.30 -            page.thead(class_="separator%s" % (is_empty and " empty" or ""))
    1.31 +            daystr, dayid = self._day_value_and_identifier(day)
    1.32 +
    1.33 +            page.thead(class_="separator%s" % (is_empty and " empty" or ""), id="region-%s" % dayid)
    1.34              page.tr()
    1.35              page.th(class_="dayheading container", colspan=all_columns+1)
    1.36              self._day_heading(day)
    1.37 @@ -563,7 +564,7 @@
    1.38              page.tr.close()
    1.39              page.thead.close()
    1.40  
    1.41 -            page.tbody(class_="points%s" % (is_empty and " empty" or ""))
    1.42 +            page.tbody(class_="points%s" % (is_empty and " empty" or ""), id="region-%s" % dayid)
    1.43              self.show_calendar_points(intervals, groups_for_day, partitioned_group_types, group_columns)
    1.44              page.tbody.close()
    1.45  
    1.46 @@ -613,7 +614,8 @@
    1.47  
    1.48              page.tr(class_=css)
    1.49              if point.indicator == Point.PRINCIPAL:
    1.50 -                page.th(class_="timeslot")
    1.51 +                timestr, timeid = self._slot_value_and_identifier(point, endpoint)
    1.52 +                page.th(class_="timeslot", id="region-%s" % timeid)
    1.53                  self._time_point(point, endpoint)
    1.54              else:
    1.55                  page.th()
    1.56 @@ -718,13 +720,12 @@
    1.57          """
    1.58          Generate a heading for 'day' of the following form:
    1.59  
    1.60 -        <label class="day day-20150203" for="day-20150203">Tuesday, 3 February 2015</label>
    1.61 +        <label class="day" for="day-20150203">Tuesday, 3 February 2015</label>
    1.62          """
    1.63  
    1.64          page = self.page
    1.65 -        daystr = format_datetime(day)
    1.66          value, identifier = self._day_value_and_identifier(day)
    1.67 -        page.label(self.format_date(day, "full"), class_="day day-%s" % daystr, for_=identifier)
    1.68 +        page.label(self.format_date(day, "full"), class_="day", for_=identifier)
    1.69  
    1.70      def _time_point(self, point, endpoint):
    1.71  
    1.72 @@ -732,15 +733,14 @@
    1.73          Generate headings for the 'point' to 'endpoint' period of the following
    1.74          form:
    1.75  
    1.76 -        <label class="timepoint day-20150203" for="slot-20150203T090000-20150203T100000">09:00:00 CET</label>
    1.77 +        <label class="timepoint" for="slot-20150203T090000-20150203T100000">09:00:00 CET</label>
    1.78          <span class="endpoint">10:00:00 CET</span>
    1.79          """
    1.80  
    1.81          page = self.page
    1.82          tzid = self.get_tzid()
    1.83 -        daystr = format_datetime(point.point.date())
    1.84          value, identifier = self._slot_value_and_identifier(point, endpoint)
    1.85 -        page.label(self.format_time(point.point, "long"), class_="timepoint day-%s" % daystr, for_=identifier)
    1.86 +        page.label(self.format_time(point.point, "long"), class_="timepoint", for_=identifier)
    1.87          page.span(self.format_time(endpoint and endpoint.point or get_end_of_day(point.point, tzid), "long"), class_="endpoint")
    1.88  
    1.89      def _slot_selector(self, value, identifier, slots):