Created
March 23, 2012 21:06
-
-
Save ecavazos/2175064 to your computer and use it in GitHub Desktop.
tiny sinatra for inside joke
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' | |
| get '/' do | |
| haml :index | |
| end | |
| post '/' do | |
| name = params[:name].downcase | |
| if name == "jim" || name == "jim clenney" || name == "bubba" | |
| @greeting = "Yam pie for you." | |
| else | |
| @greeting = "One cocoanut cream pie coming up!" | |
| end | |
| haml :index | |
| end | |
| __END__ | |
| @@ layout | |
| %html | |
| = yield | |
| @@ index | |
| - steez = 'margin: 40px auto; width:400px;text-align:center;' | |
| %form{ :method => 'post', :style => steez } | |
| %label{ :for => 'name'}Please enter your name? | |
| %input{ :id => 'name', :name => 'name', :type => 'input' } | |
| %input{ :type => 'submit' } | |
| - if @greeting | |
| %h1{ :style => steez }= @greeting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment