This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@index | |
h1 The Flash Farm Shop! | |
p Choose which animals you would like to buy from our shop. | |
ul#animals | |
li | |
h2 Duck | |
img src="/duck.png" | |
form action="/buy/duck" method="POST" | |
input type="submit" value="Add to Basket" title="Buy me, quack!" | |
li |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@index | |
h1 Sinatra Flash | |
form action="/time" method="POST" | |
input type="submit" value="What Time Is It?" title="What time is it?" | |
p The time is #{flash[:time]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post '/time' do | |
flash[:time] = Time.now.strftime("%I:%M:%S") | |
redirect '/' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@index | |
h1 Sinatra Flash | |
form action="/time" method="POST" | |
input type="submit" value="What Time Is It?" title="What time is it?" | |
p The time is #{@time} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post '/time' do | |
@time = Time.now.strftime("%I:%M:%S") | |
redirect '/' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@index | |
h1 Sinatra Flash | |
form action="/time" method="POST" | |
input type="submit" value="What Time Is It?" title="What time is it?" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__END__ | |
@@layout | |
doctype html | |
html | |
head | |
meta charset="utf-8" | |
title Sinatra Flash | |
body | |
== yield |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/' do | |
slim :index | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enable :sessions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'slim' | |
require 'sinatra/flash' |