aboutsummaryrefslogtreecommitdiff
path: root/views/alerts.haml
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-06-09 18:09:52 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-06-09 18:09:52 +0100
commit495c44445642cfae8f23fadde299ad5307f5be58 (patch)
tree0104c9eef164235aa5ab05b126c8f63e52fb8624 /views/alerts.haml
parent0c88fcc91db1b003cd5d5311f62700c7867b4099 (diff)
Big commit
--HG-- rename : views/please_authenticate.haml => views/login.haml
Diffstat (limited to 'views/alerts.haml')
-rw-r--r--views/alerts.haml84
1 files changed, 62 insertions, 22 deletions
diff --git a/views/alerts.haml b/views/alerts.haml
index af65dea..e2a8c82 100644
--- a/views/alerts.haml
+++ b/views/alerts.haml
@@ -1,24 +1,64 @@
-!!!
+!!! HTML5
%html
%head
- %title #{@title}: Current alerts (logged in as #{@person.username})
- %link{:rel => "stylesheet", :href => "/alerts.css"}
- %link{:rel => "stylesheet", :href => "/alerts-mobil.css", :media => "handheld"}
- %script{:type => "text/javascript", :src => "/prototype.js"}
- %script{:type => "text/javascript", :src => "/mauve_utils.js"}
- %script{:type => "text/javascript", :src => "/datadumper.js"}
- %body{:onLoad => "addAutoHover(); addRefresh();"}
- #header
- %h1= @title
- #errors{:style => "display: none;"}
- %h1
- Trouble!
- (
- %a{:href=>"#", :onClick => "clearErrors();"} hide
- )
- %ul#errors_list
- %p Either the alert server or your internet connection is malfunctioning, so you may want to try refreshing the page.
- #alert_counts= partial("alert_counts")
- #navigation= partial("navigation")
- #alert_summary= partial("alert_summary")
- //%p The session is #{session.inspect()}
+ %meta{:name=>"viewport", :content=>"width=device-width"}/
+ %title #{@title}: Alerts
+ %link{:rel => "stylesheet", :href => "/stylesheets/bytemark.css"}/
+ %link{:rel => "stylesheet", :href => "/stylesheets/mauve.css"}/
+ %script{:src => '/javascript/prototype/prototype.js', :type => 'text/javascript'}
+ %script{:src => '/javascript/scriptaculous/scriptaculous.js', :type => 'text/javascript'}
+ %body
+ = partial('navbar')
+ %h1 Mauve Alerts
+ %form
+ %table
+ %tr
+ %th
+ %input{ :type => "checkbox", :name => "all" }
+ %th Lvl
+ %th Subject
+ %th Summary
+ %th Raised at
+ %th Actions
+ - count = 0
+ - @grouped_alerts.each do |group, alerts|
+ - count += 1
+ - row_class = [ count % 2 == 0 && "hilight", alerts.first.raised? && "triggered", alerts.first.acknowledged? && "acknowledged"]
+ - first_n = (alerts.length > 2 ? 1 : 2)
+ - alerts.first(first_n).each do |alert|
+ %tr{ :class => row_class, :id => ["summary", alert.id] }
+ %td
+ %input{ :type => "checkbox", :name => alert.id }
+ %td #{alert.level}
+ %td #{alert.subject}
+ %td
+ #{alert.summary}
+ %a{ :href => "/alert/#{alert.id}", :onclick => "$('detail_#{alert.id}').toggle(); return false;"} show details &darr;
+ %td #{alert.raised_at}
+ %td arse
+ %tr{ :class => %w(detail) + row_class, :id => ["detail", alert.id], :style => "display: none;" }
+ %td &nbsp;
+ %td{:colspan => 5}
+ = partial(:detail, :locals => {:alert => alert})
+ %p
+ Source: #{alert.source} &bull;
+ %a{ :href => "/alert/#{alert.id}" } More details
+ &bull;
+ %a{ :href => "#", :onclick => "$('detail_#{alert.id}').hide(); return false;"} Hide details &uarr;
+ - if alerts.length > 2
+ %tr{ :class => [ count % 2 == 0 && "hilight", alerts.first.raised? && "triggered", alerts.first.acknowledged? && "acknowledged"]}
+ %td &nbsp;
+ %td{:colspan => 5} There are #{alerts.length - 1} more alerts in this group.
+ %tr
+ %td{:colspan => 6}
+ Acknowledge these alerts for
+ %input{ :name => 'hours', :type => "number", :min => 1, :max => 24, :value => 2}
+ %select
+ %option{ :value => "daytime" } daytime
+ %option{ :value => "working" } working
+ %option{ :value => "wall" } wall
+ hours (until
+ %span{:id => "ack_until"}
+ = Time.now + 2
+ )
+ %input{ :type => 'submit' }