From b97b3173bc8f5633c4378a33af929c0a59cbe3e9 Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Mon, 11 Aug 2014 00:10:40 +0100 Subject: [PATCH] Check for upcoming matches before showing the calendar --- app/views/widgets/_calendar.html.erb | 34 +++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/views/widgets/_calendar.html.erb b/app/views/widgets/_calendar.html.erb index 1936f34..ccb3094 100644 --- a/app/views/widgets/_calendar.html.erb +++ b/app/views/widgets/_calendar.html.erb @@ -1,19 +1,21 @@ -
-

<%= t('widget.schedule') %>

+<% if upcoming_matches.size > 0 %> +
+

<%= t('widget.schedule') %>

-
- <% upcoming_matches.group_by{ |e| e.start.month }.each do |month, events| %> - <% events.group_by { |e| e.start.day }.each do |day, day_events| %> -
<%= day_events.first.start.strftime("%A, %e %B") %>
- <% day_events.each do |event| %> -
-

- <%= event.start.strftime("%H:%M %Z") %> - <%= event.formatted_summary %> -

-
- <% end %> +
+ <% upcoming_matches.group_by{ |e| e.start.month }.each do |month, events| %> + <% events.group_by { |e| e.start.day }.each do |day, day_events| %> +
<%= day_events.first.start.strftime("%A, %e %B") %>
+ <% day_events.each do |event| %> +
+

+ <%= event.start.strftime("%H:%M %Z") %> + <%= event.formatted_summary %> +

+
+ <% end %> + <% end %> <% end %> - <% end %> +
-
\ No newline at end of file +<% end %>