From 7c1af85a2e083771e82ed2efefd80540287ea3de Mon Sep 17 00:00:00 2001 From: Lauren Abrams Date: Fri, 29 Jun 2018 09:31:16 -0400 Subject: [PATCH] creating a form and a submit button, while using instance variables to communicate inbetween files in Sinatra --- app.rb | 13 +++++++++++++ views/newteam.erb | 26 +++++++++++++++++++------- views/team.erb | 21 +++++++++++++-------- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/app.rb b/app.rb index 2bd6170..d2fe4ee 100644 --- a/app.rb +++ b/app.rb @@ -2,5 +2,18 @@ class App < Sinatra::Base + get '/newteam' do + erb :newteam + end + post '/team' do + @name = params[:name] + @coach = params[:coach] + @pg = params[:pg] + @sg = params[:sg] + @pf = params[:pf] + @c = params[:c] + + erb :team + end end diff --git a/views/newteam.erb b/views/newteam.erb index 2eb4207..d163f26 100644 --- a/views/newteam.erb +++ b/views/newteam.erb @@ -1,11 +1,23 @@ - - - Basketball Team Signup - - - - + + + Basketball Team Signup + + + +

Create a Basketball Team!

+
+
+
+
+
+
+
+
+ +
+ + diff --git a/views/team.erb b/views/team.erb index 1402747..32578e3 100644 --- a/views/team.erb +++ b/views/team.erb @@ -1,14 +1,19 @@ - - - Basketball Team - - - + + + Basketball Team + - - + +

Team Name: <%= @name %>

+

Coach: <%= @coach %>

+

Point Guard: <%= @pg %>

+

Shooting Guard: <%= @sg %>

+

Small Forward: <%= @sf %>

+

Power Forward: <%= @pf %>

+

Center: <%= @c %>

+