Show daily events on calendar

main2
Bob Mottram 2019-10-11 21:45:46 +01:00
parent 521249499b
commit 3464fee873
2 changed files with 30 additions and 1 deletions

View File

@ -103,6 +103,11 @@ a:link {
position: relative; position: relative;
} }
.calendar__day__event {
font-size: 2rem;
position: relative;
}
tr:nth-child(odd) > .calendar__day__cell:nth-child(odd) { tr:nth-child(odd) > .calendar__day__cell:nth-child(odd) {
color: var(--day-number); color: var(--day-number);
} }

View File

@ -2839,7 +2839,31 @@ def htmlCalendarDay(translate: {}, \
calendarStr+=' <h1>'+str(dayNumber)+' '+monthName+'</h1><br>'+str(year)+'\n' calendarStr+=' <h1>'+str(dayNumber)+' '+monthName+'</h1><br>'+str(year)+'\n'
calendarStr+='</caption>\n' calendarStr+='</caption>\n'
calendarStr+='<tbody>\n' calendarStr+='<tbody>\n'
#TODO
eventTime=None
eventDescription=None
eventPlace=None
for ev in dayEvents:
if ev['type']=='Event':
if ev.get('startTime'):
eventDate=datetime.datetime.strptime(ev['startTime'],"%Y-%m-%dT%H:%M:%S%z")
eventTime=eventDate.strftime("%H:%M")
if ev.get('name'):
eventDescription=ev['name']
elif ev['type']=='Place':
if ev.get('name'):
eventPlace=ev['name']
if eventTime and eventDescription and eventPlace:
calendarStr+='<tr><td class="calendar__day__event"><b>'+eventTime+'</b></td><td class="calendar__day__event"><i>'+eventPlace+'</i>: '+eventDescription+'</td></tr>\n'
elif eventTime and eventDescription and not eventPlace:
calendarStr+='<tr><td class="calendar__day__event"><b>'+eventTime+'</b></td><td class="calendar__day__event">'+eventDescription+'</td></tr>\n'
elif not eventTime and eventDescription and not eventPlace:
calendarStr+='<tr><td class="calendar__day__event"></td><td class="calendar__day__event">'+eventDescription+'</td></tr>\n'
elif not eventTime and eventDescription and eventPlace:
calendarStr+='<tr><td class="calendar__day__event"></td><td class="calendar__day__event"><i>'+eventPlace+'</i>: '+eventDescription+'</td></tr>\n'
elif eventTime and not eventDescription and eventPlace:
calendarStr+='<tr><td class="calendar__day__event"><b>'+eventTime+'</b></td><td class="calendar__day__event"><i>'+eventPlace+'</i></td></tr>\n'
calendarStr+='</tbody>\n' calendarStr+='</tbody>\n'
calendarStr+='</table></main>\n' calendarStr+='</table></main>\n'
calendarStr+=htmlFooter() calendarStr+=htmlFooter()