aboutsummaryrefslogtreecommitdiff
path: root/views/_alert_actions.haml
blob: 2f4eb5749cb2a600711a918a8297bd4a16dd8957 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
%select#function{ :name => 'function'}
  - if @permitted_actions.include?("acknowledge")
    %option{:value => "acknowledge"}   Acknowledge 
  - if @permitted_actions.include?("suppress")
    %option{:value => "suppress"}      Suppress notifications about
  - if @permitted_actions.include?("raise")
    %option{:value => "raise"}         Raise
  - if @permitted_actions.include?("unacknowledge")
    %option{:value => "unacknowledge"} Unacknowledge 
  - if @permitted_actions.include?("clear")
    %option{:value => "clear"}         Clear
  - if @permitted_actions.include?("unsuppress")
    %option{:value => "unsuppress"}    Unsuppress notifications about
- if defined? @alert
  this alert
- else
  these alerts
%span#hours_input
  for
  %input#n_hours{ :name => 'n_hours', :type => "number", :min => 0, :max => 48, :value => 2, :style => "min-width: 6ex;"}
  %select#type_hours{:name => 'type_of_hours'  } 
    -# Default to daytime hours
    %option{ :value => "working" }                         working
    %option{ :value => "daytime", :selected => "selected"} daytime
    %option{ :value => "wallclock" }                       wall-clock
  hours
  %span#ack_until_text
  %input#ack_until{ :value => '', :type => :hidden, :name => 'ack_until' }
%br
with the note
%input#note{ :name => 'note', :type => "text"}
%input{ :type => 'submit', :value => 'Go!' } 
:javascript
  // Make the hours bit disappear when clearing alerts.
  $('#function').change( function() {
    if( $('#function').val() == "acknowledge" || $('#function').val() == "suppress" ) {
      $('#hours_input').show();
    } else {
      $('#hours_input').hide();
    }
  });
  // Change of value in the hours box
  $('#n_hours').change( function() { 
    updateDate();
  });
  // As above, but on keypress, with a delay
  $('#n_hours').keyup( function() { 
    clearTimeout($.data(this, 'timer'));
    var wait = setTimeout(updateDate, 500);
    $(this).data('timer', wait);
  });
  // Same as the n_hours change function
  $('#type_hours').change( function() { 
    $('#n_hours').change();
  });
  // Setup the ack text on load.
  $(document).ready( function() { 
    $('#n_hours').change();
    $('#function').change();
  });