Added single alarm display
This commit is contained in:
parent
64a3f7d44a
commit
2dabdf78da
10 changed files with 43 additions and 18 deletions
|
@ -13,6 +13,7 @@ class Event:
|
|||
):
|
||||
self._calendar = calendar
|
||||
self._v = event.instance.vevent
|
||||
print(type(self.valarm_trigger))
|
||||
|
||||
@property
|
||||
def dtstart(self):
|
||||
|
@ -53,9 +54,20 @@ class Event:
|
|||
return self._calendar.get_properties(
|
||||
[caldav.elements.ical.CalendarColor()]
|
||||
)['{http://apple.com/ns/ical/}calendar-color']
|
||||
|
||||
@property
|
||||
def valarm(self):
|
||||
if hasattr(self._v, 'valarm'):
|
||||
return self._v.valarm
|
||||
return None
|
||||
|
||||
@property
|
||||
def valarm_trigger(self):
|
||||
if self.valarm is None: return None
|
||||
return self.valarm.trigger.value
|
||||
|
||||
|
||||
def fdescription(self):
|
||||
def get_fdescription(self):
|
||||
if self.description is None: return None
|
||||
return re.sub(
|
||||
r'(https?://\S+)',
|
||||
|
@ -63,13 +75,16 @@ class Event:
|
|||
html.escape(self.description),
|
||||
)
|
||||
|
||||
def freq(self):
|
||||
def get_freq(self):
|
||||
if self.rrule is None: return None
|
||||
return re.search(
|
||||
r'FREQ=([A-Z]+?);',
|
||||
self.rrule,
|
||||
).group(1)
|
||||
|
||||
def get_valarm_date(self):
|
||||
return self.dtstart + self.valarm_trigger
|
||||
|
||||
|
||||
def is_full_day(self):
|
||||
return type(self.dtstart) is datetime.date
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
@font-face {
|
||||
font-family: "remixicon";
|
||||
src: url('remixicon.eot?t=1643444096731'); /* IE9*/
|
||||
src: url('remixicon.eot?t=1643444096731#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url("remixicon.woff2?t=1643444096731") format("woff2"),
|
||||
url("remixicon.woff?t=1643444096731") format("woff"),
|
||||
url('remixicon.ttf?t=1643444096731') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
url('remixicon.svg?t=1643444096731#remixicon') format('svg'); /* iOS 4.1- */
|
||||
src: url('remixicon.eot?t=1643448644501'); /* IE9*/
|
||||
src: url('remixicon.eot?t=1643448644501#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url("remixicon.woff2?t=1643448644501") format("woff2"),
|
||||
url("remixicon.woff?t=1643448644501") format("woff"),
|
||||
url('remixicon.ttf?t=1643448644501') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
url('remixicon.svg?t=1643448644501#remixicon') format('svg'); /* iOS 4.1- */
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
|
@ -44,3 +44,4 @@
|
|||
.ri-map-pin-line:before { content: "\ef14"; }
|
||||
.ri-repeat-line:before { content: "\f074"; }
|
||||
.ri-calendar-line:before { content: "\eb27"; }
|
||||
.ri-alarm-line:before { content: "\ea1b"; }
|
||||
|
|
Binary file not shown.
|
@ -8,12 +8,12 @@
|
|||
|
||||
@font-face {
|
||||
font-family: "remixicon";
|
||||
src: url('remixicon.eot?t=1643444096731'); /* IE9*/
|
||||
src: url('remixicon.eot?t=1643444096731#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url("remixicon.woff2?t=1643444096731") format("woff2"),
|
||||
url("remixicon.woff?t=1643444096731") format("woff"),
|
||||
url('remixicon.ttf?t=1643444096731') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
url('remixicon.svg?t=1643444096731#remixicon') format('svg'); /* iOS 4.1- */
|
||||
src: url('remixicon.eot?t=1643448644501'); /* IE9*/
|
||||
src: url('remixicon.eot?t=1643448644501#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
||||
url("remixicon.woff2?t=1643448644501") format("woff2"),
|
||||
url("remixicon.woff?t=1643448644501") format("woff"),
|
||||
url('remixicon.ttf?t=1643448644501') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
|
||||
url('remixicon.svg?t=1643448644501#remixicon') format('svg'); /* iOS 4.1- */
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
|
@ -45,4 +45,5 @@
|
|||
.ri-map-pin-line:before { content: "\ef14"; }
|
||||
.ri-repeat-line:before { content: "\f074"; }
|
||||
.ri-calendar-line:before { content: "\eb27"; }
|
||||
.ri-alarm-line:before { content: "\ea1b"; }
|
||||
}
|
|
@ -11,4 +11,6 @@
|
|||
unicode=""
|
||||
horiz-adv-x="1200" d="M300 1000H1050A50 50 0 0 0 1100 950V600H1000V900H300V750L50 950L300 1150V1000zM900 200H150A50 50 0 0 0 100 250V600H200V300H900V450L1150 250L900 50V200z" /><glyph glyph-name="calendar-line"
|
||||
unicode=""
|
||||
horiz-adv-x="1200" d="M850 1050H1050A50 50 0 0 0 1100 1000V200A50 50 0 0 0 1050 150H150A50 50 0 0 0 100 200V1000A50 50 0 0 0 150 1050H350V1150H450V1050H750V1150H850V1050zM750 950H450V850H350V950H200V750H1000V950H850V850H750V950zM1000 650H200V250H1000V650z" /></font></defs></svg>
|
||||
horiz-adv-x="1200" d="M850 1050H1050A50 50 0 0 0 1100 1000V200A50 50 0 0 0 1050 150H150A50 50 0 0 0 100 200V1000A50 50 0 0 0 150 1050H350V1150H450V1050H750V1150H850V1050zM750 950H450V850H350V950H200V750H1000V950H850V850H750V950zM1000 650H200V250H1000V650z" /><glyph glyph-name="alarm-line"
|
||||
unicode=""
|
||||
horiz-adv-x="1200" d="M600 100A450 450 0 1 0 600 1000A450 450 0 0 0 600 100zM600 200A350 350 0 1 1 600 900A350 350 0 0 1 600 200zM650 550H800V450H550V800H650V550zM87.35 885.9L264.1 1062.65L334.85 991.95L158 815.15L87.35 885.9zM935.85 1062.65L1112.65 885.9L1041.9499999999998 815.15L865.1499999999999 991.95L935.8999999999997 1062.65z" /></font></defs></svg>
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.7 KiB |
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" width="0" height="0" style="display:none;"><symbol viewBox="0 0 24 24" id="map-pin-line"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 20.9l4.95-4.95a7 7 0 1 0-9.9 0L12 20.9zm0 2.828l-6.364-6.364a9 9 0 1 1 12.728 0L12 23.728zM12 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm0 2a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/></symbol><symbol viewBox="0 0 24 24" id="repeat-line"><path fill="none" d="M0 0h24v24H0z"/><path d="M6 4h15a1 1 0 0 1 1 1v7h-2V6H6v3L1 5l5-4v3zm12 16H3a1 1 0 0 1-1-1v-7h2v6h14v-3l5 4-5 4v-3z"/></symbol><symbol viewBox="0 0 24 24" id="calendar-line"><path fill="none" d="M0 0h24v24H0z"/><path d="M17 3h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4V1h2v2h6V1h2v2zm-2 2H9v2H7V5H4v4h16V5h-3v2h-2V5zm5 6H4v8h16v-8z"/></symbol></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" width="0" height="0" style="display:none;"><symbol viewBox="0 0 24 24" id="map-pin-line"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 20.9l4.95-4.95a7 7 0 1 0-9.9 0L12 20.9zm0 2.828l-6.364-6.364a9 9 0 1 1 12.728 0L12 23.728zM12 13a2 2 0 1 0 0-4 2 2 0 0 0 0 4zm0 2a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"/></symbol><symbol viewBox="0 0 24 24" id="repeat-line"><path fill="none" d="M0 0h24v24H0z"/><path d="M6 4h15a1 1 0 0 1 1 1v7h-2V6H6v3L1 5l5-4v3zm12 16H3a1 1 0 0 1-1-1v-7h2v6h14v-3l5 4-5 4v-3z"/></symbol><symbol viewBox="0 0 24 24" id="calendar-line"><path fill="none" d="M0 0h24v24H0z"/><path d="M17 3h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4V1h2v2h6V1h2v2zm-2 2H9v2H7V5H4v4h16V5h-3v2h-2V5zm5 6H4v8h16v-8z"/></symbol><symbol viewBox="0 0 24 24" id="alarm-line"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 22a9 9 0 1 1 0-18 9 9 0 0 1 0 18zm0-2a7 7 0 1 0 0-14 7 7 0 0 0 0 14zm1-7h3v2h-5V8h2v5zM1.747 6.282l3.535-3.535 1.415 1.414L3.16 7.697 1.747 6.282zm16.97-3.535l3.536 3.535-1.414 1.415-3.536-3.536 1.415-1.414z"/></symbol></svg>
|
Before Width: | Height: | Size: 825 B After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -61,7 +61,7 @@
|
|||
<div class="info">
|
||||
<div class="description">
|
||||
{% if event.description %}
|
||||
{{ event.fdescription() | safe }}
|
||||
{{ event.get_fdescription() | safe }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="other">
|
||||
|
@ -74,7 +74,13 @@
|
|||
{% if event.rrule %}
|
||||
<div>
|
||||
<i class="ri-repeat-line ri-fw ri-sm"></i>
|
||||
{{ event.freq() }}
|
||||
{{ event.get_freq() }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if event.valarm %}
|
||||
<div>
|
||||
<i class="ri-alarm-line ri-fw ri-sm"></i>
|
||||
{{ event.get_valarm_date() }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div>
|
||||
|
|
Reference in a new issue