diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/_events_calendar_day.haml | 2 | ||||
-rw-r--r-- | views/_history.haml | 2 | ||||
-rw-r--r-- | views/events_list.haml | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/views/_events_calendar_day.haml b/views/_events_calendar_day.haml index 712559c..5aee31c 100644 --- a/views/_events_calendar_day.haml +++ b/views/_events_calendar_day.haml @@ -2,7 +2,7 @@ %p.event_date %a{:href => "/events/list/#{@today.strftime("%F")}?#{request.query_string}"} = @today.strftime((@today.day == 1) ? "%d %b" : "%d") - =partial("history", :collection => events_calendar_day.last(10).alerts.to_a.reverse) + =partial("history", :collection => events_calendar_day.first(10).collect{|e| e.history.cached_alerts << e.alert ; e }.collect{|e| e.history}.uniq.sort{|a,b| a.created_at <=> b.created_at}) %p - n_events = events_calendar_day.count - if n_events > 10 diff --git a/views/_history.haml b/views/_history.haml index 400c1c3..a399113 100644 --- a/views/_history.haml +++ b/views/_history.haml @@ -3,7 +3,7 @@ = history.created_at.strftime("%a %d %b %Y") %p = history.created_at.strftime("%R") - - history.alerts.each do |alert| + - (history.cached_alerts.empty? ? history.alerts : history.cached_alerts).each do |alert| %a{ :href => self.class.url_for(alert) } = alert.id %strong diff --git a/views/events_list.haml b/views/events_list.haml index ff56310..ed08d3a 100644 --- a/views/events_list.haml +++ b/views/events_list.haml @@ -11,8 +11,8 @@ %a{:href => "/events/calendar/#{@start.strftime("%Y-%m")}?"+request.query_string} Calendar view = partial('events_form') -- if @events.length > 0 - = partial('history', :collection => @events) +- if @events.count > 0 + = partial('history', :collection => @events.collect{|e| e.history.cached_alerts << e.alert ; e }.collect{|e| e.history}.uniq.sort{|a,b| a.created_at <=> b.created_at}) - else %p %strong |