aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/_alerts_table_group.haml6
-rw-r--r--views/_events_calendar_day.haml13
-rw-r--r--views/_search_table_row.haml27
-rw-r--r--views/events_calendar.haml5
4 files changed, 37 insertions, 14 deletions
diff --git a/views/_alerts_table_group.haml b/views/_alerts_table_group.haml
index 6507377..8e9d5b7 100644
--- a/views/_alerts_table_group.haml
+++ b/views/_alerts_table_group.haml
@@ -1,10 +1,10 @@
-# Sanity checking.
- group, alerts = alerts_table_group unless alerts_table_group.nil?
- if alerts.length <= 2
- =partial("alerts_table_alert_summary", :collection => alerts)
+ =partial("search_table_row", :collection => alerts)
- else
- =partial("alerts_table_alert_summary", :collection => [alerts.first])
- =partial("alerts_table_alert_summary", :collection => alerts[1..-1], :locals => {:row_class => ["hidden"]})
+ =partial("search_table_row", :collection => [alerts.first])
+ =partial("search_table_row", :collection => alerts[1..-1], :locals => {:row_class => ["hidden"]})
%tr{:id => ["tr","group",group]}
%td &nbsp;
%td{:colspan => 2}
diff --git a/views/_events_calendar_day.haml b/views/_events_calendar_day.haml
index 1b42520..fa0c517 100644
--- a/views/_events_calendar_day.haml
+++ b/views/_events_calendar_day.haml
@@ -1,14 +1,15 @@
%td{:class => (@today.month % 2 == 0 ? "even" : "odd")}
%p.event_date
%a{:href => "/events/list/#{@today.strftime("%F")}?#{request.query_string}"}
- = @today.strftime(((@today - 1.day).month != @today.month) ? "%d %b" : "%d")
- =partial("history", :collection => events_calendar_day.first(10))
+ = @today.strftime(((@today - 1).month != @today.month) ? "%d %b" : "%d")
+ =partial("history", :collection => events_calendar_day.last(10).to_a.reverse)
%p
- - if events_calendar_day.length > 10
+ - n_events = events_calendar_day.count
+ - if n_events > 10
There are
- = events_calendar_day.length - 10
+ = n_events - 10
more events to display.
- - if events_calendar_day.length > 0
+ - if n_events > 0
%a{:href => "/events/list/#{@today.strftime("%F")}?#{request.query_string}"}
Show the whole day.
- - @today += 1.day
+ - @today += 1
diff --git a/views/_search_table_row.haml b/views/_search_table_row.haml
index e971c42..bb13298 100644
--- a/views/_search_table_row.haml
+++ b/views/_search_table_row.haml
@@ -14,5 +14,28 @@
:onclick => "fetchDetail('#{alert.id}'); return false;"}
Details &darr;
%td
- = (alert.update_type || "cleared").capitalize
- = ((alert.raised? && alert.raised_at) || (alert.acknowledged? && alert.acknowledged_at) || alert.cleared_at || alert.updated_at || Time.now).to_s_relative
+ - case alert.update_type
+ - when "cleared"
+ - if alert.will_raise_at
+ Will raise at
+ = alert.will_raise_at.to_s_human
+ - else
+ Cleared at
+ = alert.cleared_at.to_s_human
+ - when /(re-)?raised/
+ - if alert.will_clear_at
+ Will clear at
+ = alert.will_clear_at.to_s_human
+ - else
+ = alert.update_type.capitalize
+ at
+ = alert.raised_at.to_s_human
+ - when /acknowledged/
+ Ack'd at
+ = alert.acknowledged_at.to_s_human
+ until
+ = alert.will_unacknowledge_at.to_s_human
+ - else
+ = alert.update_type.capitalize
+ at
+ = alert.updated_at
diff --git a/views/events_calendar.haml b/views/events_calendar.haml
index e3cec5e..0ff4e17 100644
--- a/views/events_calendar.haml
+++ b/views/events_calendar.haml
@@ -1,11 +1,10 @@
%h2
Events Calendar
-
%p
- %a{:href => "/events/calendar/#{(@month-31.days).strftime("%Y-%m")}?"+request.query_string}
+ %a{:href => "/events/calendar/#{(@month << 1).strftime("%Y-%m")}?"+request.query_string}
&larr; Previous Month
= @month.strftime("%b %Y")
- %a{:href => "/events/calendar/#{(@month+31.days).strftime("%Y-%m")}?"+request.query_string}
+ %a{:href => "/events/calendar/#{(@month >> 1).strftime("%Y-%m")}?"+request.query_string}
Next month &rarr;
= partial('events_form')
= partial('events_calendar')