Sha256: 12e21f73e2430107506bbb6afd51508e877552a65e0e6c19646b662d227927b7

Contents?: true

Size: 1.86 KB

Versions: 3

Compression:

Stored size: 1.86 KB

Contents

.panel{:id => "#{@watch}_commands", :title => @title}
  - if @status
    %h2 Status
    %fieldset
      %div{:align => "center"}
        %p
          %b= @status.to_s.capitalize
          [#{Time.now.strftime("%H:%m %m/%d")}]
  - if @log
    %h2 Log
    %fieldset
      %div{:align => "left"}= @log
  - if @child
    %h2 Watches
    %fieldset
      %ul
        - for child in @child
          %li{:id => child[0]}
            %a{:href => "/w/#{child[0]}"}
              %img{:src => "icons/#{child[1]}.png"}/
              = child[0]
  %h2 Commands
  - unless @commands.empty?
    %fieldset
      - ["power", "monitor"].each_with_index do |comm, i|
        //%h1= comm
        .row{:onclick => "submitCommand('start', '#{@watch}')"}
          %label= comm.capitalize
          .toggle{:id => "toggle_#{comm}", :onclick => "submitCommand('#{comm}', '#{@watch}')", :toggled => @commands[i]}
            %span.thumb
            %span.toggleOn ON
            %span.toggleOff OFF
      - ["power", "monitor"].each_with_index do |comm, i|
        //%h1= comm
        .row
          %label= comm.capitalize
          %input.button{:type => "submit", :name => comm, :value => comm, :onclick => "sComm('#{comm}', 'start');" }
        .row
          %label= comm.capitalize
          %input.button{:type => "submit", :name => comm, :value => comm, :onclick => "sComm('#{comm}', 'stop');" }
  - else
    %a.greenButton{:onclick => "submitCommand('start', '#{@watch}')"}
      Start #{" All" if @child}
    %a.yellowButton{:onclick => "submitCommand('stop', '#{@watch}')"}
      Stop #{" All" if @child}
  %a.greenButton{:onclick => "submitCommand('door', '#{@watch}')"}
    Door #{" All" if @child}
  %a.redButton{:onclick => "submitCommand('restart', '#{@watch}')"}
    Restart #{" All" if @child}
  #results

:javascript
  $('.panel').toggle();
  function sComm(url, comm) {
  $.get("/w/" + url + "/" + comm);
  };

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
subduino-0.2.1 webapp/views/switch.haml
subduino-0.2.0 webapp/views/switch.haml
subduino-0.1.0 webapp/views/switch.haml