From 889b35b32a02d11473d8581ed56a3754f283ecfb Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 20 2016 20:49:03 +0000 Subject: Always display the meetings widget, even if there are no coming meetings This allows configuring the widget, for example if you made a mistake when entering the calendar's name --- diff --git a/hubs/widgets/meetings.py b/hubs/widgets/meetings.py index faf38f6..071496a 100755 --- a/hubs/widgets/meetings.py +++ b/hubs/widgets/meetings.py @@ -54,7 +54,7 @@ def next_meeting(meetings): footer_template = templating.environment.get_template('templates/meeting_footer.html') -chrome = panel(title = 'Meetings', key='meetings', footer_template=footer_template) +chrome = panel(title='Meetings', footer_template=footer_template) templating.environment.filters['humanize'] = lambda d: arrow.get(d).humanize() template = templating.environment.get_template('templates/meetings.html') position = 'both' @@ -69,7 +69,6 @@ position = 'both' validator=validators.integer, help="The number of meetings to display.") def data(session, widget, calendar, n_meetings=4): - n_meetings = int(n_meetings) base = 'https://apps.fedoraproject.org/calendar/api/meetings/?calendar=%s' url = base % calendar response = requests.get(url).json() @@ -90,7 +89,10 @@ def data(session, widget, calendar, n_meetings=4): if len(meetings) >= n_meetings: break - return dict(meetings=meetings) + return dict( + calendar=calendar, + meetings=meetings, + ) @hint(ubiquitous=True) diff --git a/hubs/widgets/templates/meetings.html b/hubs/widgets/templates/meetings.html index 7725729..b101c5f 100644 --- a/hubs/widgets/templates/meetings.html +++ b/hubs/widgets/templates/meetings.html @@ -1,4 +1,3 @@ -{% if meetings %} {% for title, next in meetings.items() %}
@@ -40,5 +39,10 @@ {% endif %}
{% if meetings | length > 1 %}
{% endif %} +{% else %} +
+
+ No coming meetings in {{ calendar }}. +
+
{% endfor %} -{% endif %}