Compare commits

..

No commits in common. "527d9642bc3bfb940c07b1f93d4594c37691fff0" and "691f9181e1af5c354a1f67c0f3890a6a285247f5" have entirely different histories.

4 changed files with 16 additions and 12 deletions

View File

@ -8,10 +8,8 @@ services:
- 5000:5000
environment:
- FABCAL_CACHE_EXPIRE=120
- LANG=de
- LC_ALL=de_DE.UTF-8
volumes:
- ./config.yml:/app/config.yml:ro
- ./config.yml:/app/config.yml
# use the line below when running this behind reverse proxy (only if it sets the proxy headers, though)
#command: --proxy-headers --forwarded-allow-ips="*"

View File

@ -1,6 +1,5 @@
import re
from babel.dates import format_datetime
from jinja2 import pass_eval_context
from markupsafe import Markup, escape
from starlette.templating import Jinja2Templates
@ -8,9 +7,6 @@ from starlette.templating import Jinja2Templates
templates = Jinja2Templates(directory="templates")
# custom filters
templates.env.filters["format_datetime"] = lambda value, format: format_datetime(value, format) #, locale="de_DE")
@pass_eval_context
def nl2br(eval_ctx, value):

View File

@ -18,9 +18,19 @@ async def generate_response(request: Request, template_name: str, **additional_c
grouped_events = list(group_by_date(events).items())
# couple of helpers
def localized_abbreviated_month(dt: datetime):
return babel.dates.format_datetime(dt, format="%b", locale="de_DE")
# couple of helpers
def localized_abbreviated_weekday(dt: datetime):
return babel.dates.format_datetime(dt, format="%b", locale="de_DE")
context = {
"request": request,
"grouped_events": grouped_events,
"localized_abbreviated_month": localized_abbreviated_month,
"localized_abbreviated_weekday": localized_abbreviated_weekday,
}
context.update(additional_context)

View File

@ -6,22 +6,22 @@
<div class="calendar-date">
<div class="calendar-date-date">
<div class="calendar-date-month">
{{ start_date | format_datetime("MMM") }}
{{ start_date.strftime("%b") }}
</div>
<div class="calendar-date-day">
{{ start_date | format_datetime("d") }}
{{ start_date.strftime("%d") }}
</div>
<div class="calendar-date-weekday">
{{ start_date | format_datetime("EEE") }}
{{ start_date.strftime("%a") }}
</div>
</div>
<div class="calendar-events">
{% for event in events %}
<div class="calendar-event" title="{{ event.summary }}{% if event.description %} &mdash; {{ event.description }}{% endif %}">
<div class="calendar-event-time">
<div class="calendar-event-starttime">{{ event.start | format_datetime("HH:mm") }}</div>
<div class="calendar-event-starttime">{{ event.start.strftime("%H:%M") }}</div>
<div class="calendar-event-timesep"></div>
<div class="calendar-event-endtime">{{ event.end | format_datetime("HH:mm") }}</div>
<div class="calendar-event-endtime">{{ event.end.strftime("%H:%M") }}</div>
</div>
<div class="calendar-event-description">
{% if event.description or event.location %}