Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,19 @@

class App < Sinatra::Base

end
get '/' do
erb :index
end

get '/new' do
erb :create_puppy
end

post '/' do
@name = params[:name]
@breed = params[:breed]
@age = params[:age]
erb :display_puppy
end

end
9 changes: 9 additions & 0 deletions models/puppy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Puppy
attr_accessor :name, :breed, :age
def initialize(name, breed, age)
@name = name
@breed = breed
@age = age
end

end
17 changes: 17 additions & 0 deletions views/create_puppy.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Puppy Page</title>
</head>
<body>
<h1>Tell us about your pup</h1>
<form method="post" action="/">
<p>Name:<input type="text" name="name"></p>
<p>Breed:<input type="text" name="breed"></p>
<p>Age: <input type="text" name="age"></p>
<input type="submit" id = "submit">
</form>

</body>
</html>
17 changes: 17 additions & 0 deletions views/display_puppy.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Puppy Page</title>
</head>
<body>
<h1>What a beautiful Pup!</h1>
<p>Puppy Name: <%= @name %></p>
<p>Puppy Breed: <%= @breed %></p>
<p>Puppy Age: <%= @age %></p>

<form>
<input name="submit" type="submit" id = "submit">
</form>
</body>
</html>
11 changes: 11 additions & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Puppy Page</title>
</head>
<body>
<h1>Welcome!</h1>
<a href="http://127.0.0.1:9393/new"> Click Here To List A Puppy</a>
</body>
</html>