public
Created

Sinatra jQuery Mobile App Chunk 5

  • Download Gist
gistfile1.rb
Ruby
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
__END__
 
@@ layout
!!! 5
%html{:lang => 'en'}
%head
%meta{:charset => 'utf-8'}
%meta{:name => 'viewport', :content => 'width=device-width, initial-scale=1'}
%meta{:name => 'format-detection', :content => 'telephone=no'}
%title PillTracker
%link{:href => '//code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.css', :rel => 'stylesheet'}
%link{:href => '//dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.css', :rel => 'stylesheet'}
%script{:src => '//code.jquery.com/jquery-1.7.1.min.js'}
%script{:src => '//code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js'}
%script{:src => '//dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.js'}
%body
%div{'data-role' => 'page'}
%div{'data-role' => 'header'}
%h2 PillTracker
= yield(:layout)
 
@@ index
%ul.ui-listview{:data => {:role => 'listview', :theme => 'b'}}
%li{:data => {:theme => 'a'}}
%a{href:'/new/'} New
- @events.each do |event|
%li
%img{:style => 'float:left;margin:1em;',
:src => event.type == 'took' ? 'pills.png' : 'stethoscope.png'}
%div&= event.time.strftime("%Y-%m-%d %H:%M")
%div&= "#{event.type}: #{event.description}"
 
@@ new
%form{:action => '/new/', :method => 'post'}
%p
%label{:for => 'event'} Event
%p
%fieldset{:data => {:role => 'controlgroup', :type => 'horizontal'}}
%input{:type => 'radio', :name => 'type', :id => 'took', :value => 'took', :checked => 'checked'}
%label{:for => 'took'} took
%input{:type => 'radio', :name => 'type', :id => 'feel', :value => 'feel'}
%label{:for => 'feel'} feel
%p
%label{:for => 'time'} Time
%p
%input{:name => 'time', :id => 'time', :type => 'date', 'data-role' => 'datebox',
:value => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
'data-options' => '{"mode": "slidebox", "dateFormat":"YYYY-MM-DD GG:ii", "timeFormat":24, "fieldsOrderOverride":["y","m","d","h","i"]}'}
%p
%label{ :for => 'description'} Description
%p
%textarea{:name => 'description', :id => 'description'}
%p
%a{:href => '/', :data => {:role => 'button', :data => 'true'}} Cancel
%button.ui-btn-hidden{:type => 'submit', 'data-theme'=>'a', 'aria-disabled'=>'false'} Save

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.