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

I had Puppy's instead of Puppy #5

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
16 changes: 15 additions & 1 deletion app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@

class App < Sinatra::Base

end
get '/' do
erb :index
end

get '/new' do
erb :create_puppy
end

post '/new' do
@puppy = Puppy.new(params[:name], params[:breed], params[:age])

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

def initialize(name, breed, age)
@name = name
@breed = breed
@age = age
end

end
13 changes: 13 additions & 0 deletions views/create_puppy.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h1>Create New Puppy Listing</h1>

<form method="post" action="/new">
<p>Input the puppy's name:
<input type="text" name="name"></p>
<p>Input the puppy's breed:
<input type="text" name="breed"></p>
<p>Input the puppy's age:
<input type="text" name="age"></p>
<br>
<!-- <input type="submit" name="submit"> -->
<button type="submit" value="submit">Submit</button>
</form>
10 changes: 10 additions & 0 deletions views/display_puppy.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<h1>New Puppy Listing</h1>

<p>Puppy Name:</p>
<p><%= @puppy.name %></p>
<br>
<p>Puppy Breed:</p>
<p><%= @puppy.breed %></p>
<br>
<p>Puppy Age:</p>
<p><%= @puppy.age %></p>
1 change: 1 addition & 0 deletions views/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a href="/new">Click Here To List A Puppy</a>