Skip to content

Commit

Permalink
intial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ashley williams committed Dec 11, 2013
0 parents commit 3b01366
Show file tree
Hide file tree
Showing 14 changed files with 347 additions and 0 deletions.
9 changes: 9 additions & 0 deletions GEMFILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "http://rubygems.org"

gem 'sinatra'

group :development do
gem 'tux'
gem 'shotgun'
gem 'debugger'
end
45 changes: 45 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
GEM
remote: http://rubygems.org/
specs:
bond (0.4.3)
columnize (0.3.6)
debugger (1.6.3)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
debugger-ruby_core_source (~> 1.2.4)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.2.4)
rack (1.5.2)
rack-protection (1.5.1)
rack
rack-test (0.6.2)
rack (>= 1.0)
ripl (0.7.0)
bond (~> 0.4.2)
ripl-multi_line (0.3.1)
ripl (>= 0.3.6)
ripl-rack (0.2.0)
rack (>= 1.0)
rack-test (>= 0.5)
ripl (>= 0.3.5)
shotgun (0.9)
rack (>= 1.0)
sinatra (1.4.4)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
tilt (1.4.1)
tux (0.3.0)
ripl (>= 0.3.5)
ripl-multi_line (>= 0.2.4)
ripl-rack (>= 0.2.0)
sinatra (>= 1.2.1)

PLATFORMS
ruby

DEPENDENCIES
debugger
shotgun
sinatra
tux
18 changes: 18 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'bundler'
Bundler.require

class FormParty < Sinatra::Application

get '/' do
erb :index
end

get '/:form_type' do
erb params[:form_type].to_sym
end

post '/:form_type' do
erb :results
end

end
3 changes: 3 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require './app'

run FormParty
44 changes: 44 additions & 0 deletions views/contact.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<h1>Contact Form</h1>
<form action="/contact" method="POST">

<label for="POST-first">First Name:</label>
<input id="POST-first" type="text" name="first">

<label for="POST-last">Last Name:</label>
<input id="POST-last" type="text" name="last">

<br/>

<label for="POST-email">Email:</label>
<input id="POST-email" type="email" name="email">

<br/>

<label for="POST-address1">Address 1:</label>
<input id="POST-address1" type="text" name="address1">

<br/>

<label for="POST-address2">Address 2:</label>
<input id="POST-address2" type="text" name="address2">

<br/>

<label for="POST-city">City:</label>
<input id="POST-city" type="text" name="city">

<label for="POST-state">State:</label>
<input id="POST-state" type="text" name="state">

<label for="POST-zip">Zip:</label>
<input id="POST-zip" type="text" name="zip">

<br/>

<label for="POST-phone">Phone Number:</label>
<input id="POST-phone" type="text" name="phone">

<br/>

<button type="submit" value="Sign Me Up!">Sign Me Up!</button>
</form>
10 changes: 10 additions & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<h1>Form Party</h1>
<ul>
<li><a href="/contact">Contact</a></li>
<li><a href="/newsletter">Newsletter</a></li>
<li><a href="/order">Order</a></li>
<li><a href="/rsvp">RSVP</a></li>
<li><a href="/search">Search</a></li>
<li><a href="/survey">Survey</a></li>
<li><a href="/tweet">Tweet</a></li>
</ul>
10 changes: 10 additions & 0 deletions views/layout.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Form Party</title>
</head>
<body>
<%= yield %>
<a href="/"> << Back to Form Party </a>
</body>
</html>
14 changes: 14 additions & 0 deletions views/newsletter.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<h1>Survey</h1>
<form action="/contact" method="POST">

<label for="POST-name">Name:</label>
<input id="POST-name" type="text" name="name">

<label for="POST-email">Email:</label>
<input id="POST-email" type="email" name="email">

<label for="POST-newsletter">Sign Me Up for the Newsletter!</label>
<input id="POST-newsletter" type="checkbox" name="newsletter">

<button type="submit" value="Submit">Submit</button>
</form>
75 changes: 75 additions & 0 deletions views/order.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<h1>Order Form</h1>
<form action="/order" method="POST">

<label for="POST-item1">Item1:</label>
<select id="POST-item1" name="item[0][name]">
<option value="bigfoot">Bigfoot the Holiday Yeti Holiday Ornament</option>
<option value="guineapig">Santa Guinea Pig Outfit</option>
<option value="beardski">Bearded Ski Masks</option>
<option value="inflatable">Inflatable Santa Suit</option>
<option value="uglyhan">Ugly Hanukkah Sweater</option>
<option value="donut">Donut Behind Glass</option>
<option value="pizza">Pizza Slice-Shaped Bean Bag Chair</option>
</select>

<label for="POST-item1_quant">Quantity:</label>
<select id="POST-item1_quant" name="item[0][quant]">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>

<br/>

<label for="POST-item2">Item2:</label>
<select id="POST-item2" name="item[1][name]">
<option value="bigfoot">Bigfoot the Holiday Yeti Holiday Ornament</option>
<option value="guineapig">Santa Guinea Pig Outfit</option>
<option value="beardski">Bearded Ski Masks</option>
<option value="inflatable">Inflatable Santa Suit</option>
<option value="uglyhan">Ugly Hanukkah Sweater</option>
<option value="donut">Donut Behind Glass</option>
<option value="pizza">Pizza Slice-Shaped Bean Bag Chair</option>
</select>

<label for="POST-item2_quant">Quantity:</label>
<select id="POST-item2_quant" name="item[1][quant]">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>

</br>

<br/>

<h3>Deliver to:</h3>

<label for="POST-address1">Address 1:</label>
<input id="POST-address1" type="text" name="address1">

<br/>

<label for="POST-address2">Address 2:</label>
<input id="POST-address2" type="text" name="address2">

<br/>

<label for="POST-city">City:</label>
<input id="POST-city" type="text" name="city">

<label for="POST-state">State:</label>
<input id="POST-state" type="text" name="state">

<label for="POST-zip">Zip:</label>
<input id="POST-zip" type="text" name="zip">

<br/>

<label for="POST-notes">Notes:</label>
<input id="POST-notes" type="text" name="notes">

</br>

<button type="submit" value="Place Order">Place Order</button>
</form>
2 changes: 2 additions & 0 deletions views/results.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Form Submission Results</h1>
<p><%= params.inspect %></p>
31 changes: 31 additions & 0 deletions views/rsvp.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<h1>RSVP Form</h1>
<form action="/rsvp" method="POST">

<label for="POST-name">Name:</label>
<input id="POST-name" type="text" name="name">

<br/>

<label for="POST-guests">Guests:</label>
<select id="POST-guests" name="guests">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>

<br/>

<label for="POST-item">I will bring:</label>
<input type="radio" id="wine" name="item" value="Wine">Wine</input>
<input type="radio" id="cheese" name="item" value="Cheese">Cheese</input>
<input type="radio" id="crackers" name="item"value="Crackers">Crackers</input>

<br/>

<label for="POST-attendance">I will attend the party!</label>
<input id="POST-attendance" type="checkbox" name="attendance">
<br/>

<button type="submit" value="RSVP">RSVP</button>

</form>
7 changes: 7 additions & 0 deletions views/search.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h1>Search Form</h1>
<form action="/search" method="POST">

<input id="POST-search" type="text" name="search-term">

<button type="submit" value="Search">Search</button>
</form>
63 changes: 63 additions & 0 deletions views/survey.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<h1>Survey</h1>
<form action="/contact" method="POST">

<h1>Personal Info</h1>

<label for="POST-name">Name:</label>
<input id="POST-name" type="text" name="personal[name]">

<label for="POST-email">Age:</label>
<input id="POST-email" type="number" name="personal[age]">

<label for="POST-item">Gender</label>
<input type="radio" id="male" name="personal[gender]" value="male">Male</input>
<input type="radio" id="female" name="personal[gender]" value="female">Female</input>
<input type="radio" id="other" name="personal[gender]"value="other">Other</input>

<br/>

<h1>Family Members</h1>

<label for="POST-name">Name:</label>
<input id="POST-name" type="text" name="family[0][name]">

<label for="POST-email">Age:</label>
<input id="POST-email" type="number" name="family[0][age]">

<label for="POST-item">Gender</label>
<input type="radio" id="male" name="family[0][gender]" value="male">Male</input>
<input type="radio" id="female" name="family[0][gender]" value="female">Female</input>
<input type="radio" id="other" name="family[0][gender]"value="other">Other</input>

<br/>

<label for="POST-name">Name:</label>
<input id="POST-name" type="text" name="family[1][name]">

<label for="POST-email">Age:</label>
<input id="POST-email" type="number" name="family[1][age]">

<label for="POST-item">Gender</label>
<input type="radio" id="male" name="family[1][gender]" value="male">Male</input>
<input type="radio" id="female" name="family[1][gender]" value="female">Female</input>
<input type="radio" id="other" name="family[1][gender]"value="other">Other</input>

<br/>

<label for="POST-name">Name:</label>
<input id="POST-name" type="text" name="family[2][name]">

<label for="POST-email">Age:</label>
<input id="POST-email" type="number" name="family[2][age]">

<label for="POST-item">Gender</label>
<input type="radio" id="male" name="family[2][gender]" value="male">Male</input>
<input type="radio" id="female" name="family[2][gender]" value="female">Female</input>
<input type="radio" id="other" name="family[2][gender]"value="other">Other</input>

<br/>



<button type="submit" value="Submit">Submit</button>
</form>
16 changes: 16 additions & 0 deletions views/tweet.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<h1>Tweet Form</h1>
<form action="/tweet" method="POST">

<label for="POST-username">Username:</label>
<input id="POST-username" type="text" name="username">

<label for="POST-password">Password:</label>
<input id="POST-password" type="password" name="password">

<br/>

<label for="POST-tweet">Tweet:</label>
<input id="POST-tweet" type="text" name="tweet">

<button type="submit" value="Sign Me Up!">Tweet</button>
</form>

0 comments on commit 3b01366

Please sign in to comment.