Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
15 changes: 14 additions & 1 deletion app.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
require_relative 'config/environment'

class App < Sinatra::Base
get '/' do
erb :index
end

end
get '/new' do
erb :create_puppy
end

post '/puppy' do
@name = params['name']
@age = params['age']
@breed = params['breed']
erb :display_puppy
end
end
11 changes: 11 additions & 0 deletions models/puppy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Puppy

attr_accessor :name, :breed, :age
puppies = []

def initialize(name, breed, age)
@name = name
@breed = breed
@age = age
end
end
9 changes: 9 additions & 0 deletions views/create_puppy.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<form method="post" action="/puppy">
<label for="name"> Puppy Name</label>
<input type="text" id="name" name="name">
<label for="breed"> Puppy Breed</label>
<input type="text" id="breed" name="breed">
<label for="age"> Puppy Age</label>
<input type="text" id="age" name="age">
<input type="submit" value="submit">
</form>
5 changes: 5 additions & 0 deletions views/display_puppy.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<body>
<p>Puppy Name: <%= @name %></p>
<p>Puppy Breed: <%= @breed %></p>
<p>Puppy Age: <%= @age %></p>
</body>
3 changes: 3 additions & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1> Welcome to the puppy adoption site!</h1>

<a href="/new">Click Here To List A Puppy</a>