From fedbfc7b9918878b8302a26a90fffc71afb15e63 Mon Sep 17 00:00:00 2001 From: Kevin Skilton Date: Fri, 3 May 2019 11:04:57 -0400 Subject: [PATCH] done --- app.rb | 18 +++++++++++++++++- models/puppy.rb | 9 +++++++++ views/create_puppy.erb | 9 +++++++++ views/display_puppy.erb | 5 +++++ views/index.erb | 4 ++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/app.rb b/app.rb index b1f74e9..478a66a 100644 --- a/app.rb +++ b/app.rb @@ -2,4 +2,20 @@ class App < Sinatra::Base -end \ No newline at end of file + get '/' do + erb :index + 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 diff --git a/models/puppy.rb b/models/puppy.rb index e69de29..2b54bed 100644 --- a/models/puppy.rb +++ b/models/puppy.rb @@ -0,0 +1,9 @@ +class Puppy + attr_accessor :name, :breed, :age + + def initialize(name, breed, age) + @name = name + @breed = breed + @age = age + end +end diff --git a/views/create_puppy.erb b/views/create_puppy.erb index e69de29..aca3770 100644 --- a/views/create_puppy.erb +++ b/views/create_puppy.erb @@ -0,0 +1,9 @@ +
+ + + + + + + +
diff --git a/views/display_puppy.erb b/views/display_puppy.erb index e69de29..6fbd83f 100644 --- a/views/display_puppy.erb +++ b/views/display_puppy.erb @@ -0,0 +1,5 @@ + +

Puppy Name: <%= @name %>

+

Puppy Breed: <%= @breed %>

+

Puppy Age: <%= @age %>

+ diff --git a/views/index.erb b/views/index.erb index e69de29..2cfe5d2 100644 --- a/views/index.erb +++ b/views/index.erb @@ -0,0 +1,4 @@ + +

Welcome to the puppy adoption site!

+ +Click Here To List A Puppy