lawrencechanyewlong/wherewolfpro

View on GitHub
app/views/event/message.html.haml

Summary

Maintainability
Test Coverage
.container
  %h1 Message
  
  
  %form{:id => "message", :action => "/event/store_message", :method => "post"}
    
    %textarea.form-control{:placeholder => "Input text here...",:rows=>"3", :id => "msg-text", :name => "message"}
      #{@message}
    %br
    %p
      %b> or select one of these
      \
      .list-group
        - @messagehistory.each do |h|
          - if h[:message] != "On my way!" and h[:message] != "See you!" and h[:message] != "Rushing over now!"
            %button.list-group-item.msg-tmpl{:type => "button"}#{h[:message]}
        %button.list-group-item.msg-tmpl{:type => "button"} On my way!
        %button.list-group-item.msg-tmpl{:type => "button"} See you!
        %button.list-group-item.msg-tmpl{:type => "button"} Rushing over now!
        
        
    
    
    %nav.navbar.navbar-fixed-bottom{:style => "background: #000; padding: 20px"}
      .container
        .row
          .col-xs-3
            %a.btn.btn-danger{:href => "/event/select_duration"} 
              %span.glyphicon.glyphicon-arrow-left{"aria-hidden" => "true"}
              %span Back
          .col-xs-6
          .col-xs-3
            %button.btn.btn-success{:type => "submit"}
              %span Next
              %span.glyphicon.glyphicon-arrow-right{"aria-hidden" => "true"}
  :javascript
    var x = document.getElementsByClassName("msg-tmpl");
    for (var i = 0; i < x.length; i ++) {
      x[i].addEventListener('click', function(event) {
        document.getElementById('msg-text').value = this.innerHTML;
      })
    }