summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2016-04-04 11:04:38 -0300
committerChristian Franke <nobody@nowhere.ws>2016-04-04 11:04:38 -0300
commitc5cc5086d00786cfb8696655ffbd95922dc5d68c (patch)
tree9d4830dc5af572c703dc0be1d8e8797aef3d9494
parentde724c6a5efafd575c25953ba4d824b05a9f7e21 (diff)
Include onetime events in head
-rw-r--r--scripts/calendar_plugin.py4
-rw-r--r--template/calendar.j215
-rw-r--r--template/calendar_event.j214
-rw-r--r--template/calendar_head.j210
4 files changed, 27 insertions, 16 deletions
diff --git a/scripts/calendar_plugin.py b/scripts/calendar_plugin.py
index 8463ec1..af7408b 100644
--- a/scripts/calendar_plugin.py
+++ b/scripts/calendar_plugin.py
@@ -29,8 +29,8 @@ class CalendarPlugin:
}).encode('utf-8')
def _get_calendar_head(self):
- return self.template_env.get_template('calendar.j2').render({
- 'events': self.events[:7],
+ return self.template_env.get_template('calendar_head.j2').render({
+ 'events': self.events,
'class': 'calendar-head'
}).encode('utf-8')
diff --git a/template/calendar.j2 b/template/calendar.j2
index ea851a2..f69018c 100644
--- a/template/calendar.j2
+++ b/template/calendar.j2
@@ -1,18 +1,5 @@
<div class="calendar-listing {{ class }}">
{%- for event in events %}
- {%- if event.recurring %}
- <p class="recurring">
- {%- else %}
- <p class="onetime">
- {%- endif -%}
- <span class="date">
- {%- if event.multiday %}
- {{- event.start.strftime('%A, %d. %B %Y').decode('utf-8') }} - {{ event.end.strftime('%A, %d. %B %Y').decode('utf-8') }}
- {%- else %}{{ event.start.strftime('%A, %d. %B %Y, %H:%M Uhr').decode('utf-8') }}
- {%- endif -%}
- </span> <span class="name">{{ event.name }}</span></p>
- <div>
- <p>{{ event.description|default('Keine Beschreibung',true) }}</p>
- </div>
+ {% include 'calendar_event.j2' %}
{%- endfor %}
</div>
diff --git a/template/calendar_event.j2 b/template/calendar_event.j2
new file mode 100644
index 0000000..106b65a
--- /dev/null
+++ b/template/calendar_event.j2
@@ -0,0 +1,14 @@
+{%- if event.recurring %}
+<p class="recurring">
+{%- else %}
+<p class="onetime">
+{%- endif -%}
+ <span class="date">
+ {%- if event.multiday %}
+ {{- event.start.strftime('%A, %d. %B %Y').decode('utf-8') }} - {{ event.end.strftime('%A, %d. %B %Y').decode('utf-8') }}
+ {%- else %}{{ event.start.strftime('%A, %d. %B %Y, %H:%M Uhr').decode('utf-8') }}
+ {%- endif -%}
+ </span> <span class="name">{{ event.name }}</span></p>
+<div>
+ <p>{{ event.description|default('Keine Beschreibung',true) }}</p>
+</div>
diff --git a/template/calendar_head.j2 b/template/calendar_head.j2
new file mode 100644
index 0000000..d8df951
--- /dev/null
+++ b/template/calendar_head.j2
@@ -0,0 +1,10 @@
+<div class="calendar-listing {{ class }}">
+{%- for event in events[:7] %}
+ {% include 'calendar_event.j2' %}
+{%- endfor %}
+{%- for event in events[7:] %}
+ {% if not event.recurring %}
+ {% include 'calendar_event.j2' %}
+ {% endif %}
+{%- endfor %}
+</div>