From 495c44445642cfae8f23fadde299ad5307f5be58 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 9 Jun 2011 18:09:52 +0100 Subject: Big commit --HG-- rename : views/please_authenticate.haml => views/login.haml --- views/_detail.haml | 3 ++ views/_header.haml | 9 +++++ views/_navbar.haml | 15 ++++++++ views/_navigation.haml | 2 +- views/alert.haml | 12 +++--- views/alerts.haml | 84 +++++++++++++++++++++++++++++++----------- views/login.haml | 27 ++++++++++++++ views/please_authenticate.haml | 25 ------------- 8 files changed, 123 insertions(+), 54 deletions(-) create mode 100644 views/_detail.haml create mode 100644 views/_header.haml create mode 100644 views/_navbar.haml create mode 100644 views/login.haml delete mode 100644 views/please_authenticate.haml (limited to 'views') diff --git a/views/_detail.haml b/views/_detail.haml new file mode 100644 index 0000000..282e454 --- /dev/null +++ b/views/_detail.haml @@ -0,0 +1,3 @@ +.detail + :textile + #{alert.detail} diff --git a/views/_header.haml b/views/_header.haml new file mode 100644 index 0000000..4f5c12a --- /dev/null +++ b/views/_header.haml @@ -0,0 +1,9 @@ +!!! XML +!!! +%html + %head + %meta{:name=>"viewport", :content=>"width=device-width"}/ + %title #{@title}: Authentication required + %link{:rel => "stylesheet", :href => "/stylesheets/bytemark.css"}/ + %link{:rel => "stylesheet", :href => "/stylesheets/mauve.css"}/ + %script{:src => 'javascript/jquery/jquery.js', :type => 'text/javascript'} diff --git a/views/_navbar.haml b/views/_navbar.haml new file mode 100644 index 0000000..2384baf --- /dev/null +++ b/views/_navbar.haml @@ -0,0 +1,15 @@ +#navbar + %ul + %li + %a{:href => "/"} Mauve + - if @person + %li{:id => [ @alert_type == "raised" && "nav_selected"]} + %a{:href => '/alerts/raised/'+@group_by} Raised (#{@alerts_raised.length}) + %li{:id => [ @alert_type == "acknowledged" && "nav_selected"]} + %a{:href => '/alerts/acknowledged/'+@group_by} Ack'd (#{@alerts_ackd.length}) + %li{:id => [ @alert_type == "cleared" && "nav_selected"]} + %a{:href => '/alerts/cleared/'+@group_by} Cleared (#{@alerts_cleared.length}) + %li + %a{:href => '/logout'} Log out + %br + diff --git a/views/_navigation.haml b/views/_navigation.haml index 6c47b28..c3301b2 100644 --- a/views/_navigation.haml +++ b/views/_navigation.haml @@ -5,7 +5,7 @@ %a{:href => "/logout"} Logout (#{@person.username}) - else %form{:action => '/login', :method => :POST} - Username + UsernameArse %input{:name => 'username', :type => 'text', :size => 10} Password %input{:name => 'password', :type => 'password', :size => 10} diff --git a/views/alert.haml b/views/alert.haml index 4310ddc..9d25c47 100644 --- a/views/alert.haml +++ b/views/alert.haml @@ -2,18 +2,18 @@ %html %head %title #{@title}: Alert #{@alert.id}: #{@alert.get_safe_html_summary} - %link{:rel => "stylesheet", :href => "/alerts2.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"} + %link{:rel => "stylesheet", :href => "/alerts2.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();"} .head= partial("head3") #about_alert %h1.summary #{@alert.get_safe_html_subject}: #{@alert.get_safe_html_summary} %h2.details Alert Details - if @alert.detail - .detail= @alert.get_details + .arse= partial("detail") - if @alert.source != @alert.subject %h2.source Source .source= @alert.get_safe_html_source 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 ↓ + %td #{alert.raised_at} + %td arse + %tr{ :class => %w(detail) + row_class, :id => ["detail", alert.id], :style => "display: none;" } + %td   + %td{:colspan => 5} + = partial(:detail, :locals => {:alert => alert}) + %p + Source: #{alert.source} • + %a{ :href => "/alert/#{alert.id}" } More details + • + %a{ :href => "#", :onclick => "$('detail_#{alert.id}').hide(); return false;"} Hide details ↑ + - if alerts.length > 2 + %tr{ :class => [ count % 2 == 0 && "hilight", alerts.first.raised? && "triggered", alerts.first.acknowledged? && "acknowledged"]} + %td   + %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' } diff --git a/views/login.haml b/views/login.haml new file mode 100644 index 0000000..225c2e8 --- /dev/null +++ b/views/login.haml @@ -0,0 +1,27 @@ +!!! XML +!!! +%html + %head + %meta{:name=>"viewport", :content=>"width=device-width"}/ + %title #{@title}: Authentication required + %link{:rel => "stylesheet", :href => "/stylesheets/bytemark.css"}/ + %link{:rel => "stylesheet", :href => "/stylesheets/mauve.css"}/ + %script{:src => 'javascript/jquery/jquery.js', :type => 'text/javascript'} + %body + = partial('navbar') + %h1 Mauve Alerts + - if flash['error'] + %p.error= flash['error'] + %form{:action => '/login', :method => :POST} + %fieldset + %legend Please log in + %label{:for => "username"} Username + %input{:name => 'username', :type => 'text'}/ + %br + %label{:for => "password", :title => "This is either your Single Sign On password or a PIN."} Password / PIN + %input{:name => 'password', :type => 'password'}/ + %br + %input{:type => 'hidden', :name => 'next_page', :value => @next_page}/ + %input{:type => 'submit', :value => 'Log in'}/ + + diff --git a/views/please_authenticate.haml b/views/please_authenticate.haml deleted file mode 100644 index 9416c8e..0000000 --- a/views/please_authenticate.haml +++ /dev/null @@ -1,25 +0,0 @@ -!!! -%html - %head - %meta{:name=>"viewport", :content=>"width=device-width"} - %title #{@title}: Authentication required - %link{:rel => "stylesheet", :href => "/alerts2.css"} - %body - .loginForm - %form{:action => '/login', :method => :POST} - Username - %input{:name => 'username', :type => 'text'} - %br - Password - %input{:name => 'password', :type => 'password'} - %br - %input{:type => 'submit', :value => 'Log into the Mauve alert panel', :class=>"submitLoginButton"} - .loginNotes - This is either your single sign on or a PIN. - %br - You - %strong - must - be logged in to view alerts. - - -- cgit v1.2.1