Sha256: b16337bb925e491916f5d87eabcfb216a089f65f13b705495e51e114097e1de3

Contents?: true

Size: 1.02 KB

Versions: 18

Compression:

Stored size: 1.02 KB

Contents

require 'sinatra'
require 'erb'

get '/' do
  "Hello World!!"
end

get '/form' do
  erb :index
end

post '/result' do
  erb :index
end

get '/confirm' do
  erb :confirm
end

post '/result_confirm' do
  erb :confirm
end


__END__

@@ index
<!DOCTYPE html>
<html>
  <head>
    <style>
      body { background-color: #aaaaaa; }
      div#result { color: red; }
    </style>
  </head>
  <body>
    <div id="result"><%= params[:name] %></div>
    <form method="POST" action="/result">
      <label>Name: <input type="text" name="name"></label>
      <input type="submit" value="Go!" />
    </form>
  </body>
</html>

@@ confirm
<!DOCTYPE html>
<html>
  <head>
    <style>
      body { background-color: #aaaaaa; }
      div#result { color: red; }
    </style>
  </head>
  <body>
    <div id="result"><%= params[:name] %></div>
    <form method="POST" action="/result_confirm">
      <label>Name: <input type="text" name="name"></label>
      <input type="submit" value="Go!" onclick="return confirm('submit?');" />
    </form>
  </body>
</html>

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gnawrnip-0.8.0 example/web.rb
gnawrnip-0.7.0 example/web.rb
gnawrnip-0.6.0 example/web.rb
gnawrnip-0.5.0 example/web.rb
gnawrnip-0.4.0 example/web.rb
gnawrnip-0.3.2 example/web.rb
gnawrnip-0.3.1 example/web.rb
gnawrnip-0.3.0 example/web.rb
gnawrnip-0.2.5 example/web.rb
gnawrnip-0.2.4 example/web.rb
gnawrnip-0.2.3 example/web.rb
gnawrnip-0.2.2 example/web.rb
gnawrnip-0.2.1 example/web.rb
gnawrnip-0.2.0 example/web.rb
gnawrnip-0.1.3 example/web.rb
gnawrnip-0.1.2 example/web.rb
gnawrnip-0.1.1 example/web.rb
gnawrnip-0.1.0 example/web.rb