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

Test to Home page #251

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Test to Home page #251

wants to merge 4 commits into from

Conversation

HanzAkor
Copy link

@HanzAkor HanzAkor commented Jul 8, 2022

Made a small change

@HanzAkor HanzAkor closed this Jul 8, 2022
@HanzAkor HanzAkor reopened this Jul 9, 2022
Copy link

@jordanmarkham jordanmarkham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is ready to have the finishing touches added to it in order for it to work - just requires the results functionality and a bit of tidying up indentation.

erb :index
end

post '/names' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation isn't in line with rest of code

@@ -0,0 +1,16 @@
<!DOCTYPE html>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTML structure isn't required for ERB files to work


post '/names' do
session[:player_name] = params[:player_name]
redirect '/play'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be done without /names? Maybe in /play instead to save having to redirect the user?

<p>Make your selection: Rock, Paper or Scissors</p>

<form action="/result" method="get" class="rps">
<input type="submit" value="Rock">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a button might be more helpful - "Input" does take a value but it might be more useful. Button requires a name, which can then be accessed by app.rb

end

get '/result' do
@player_name = session[:player_name]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation needs fixing

end

get '/result' do
@player_name = session[:player_name]
erb :result

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this, you should access the button/input value from the user (rock, paper or scissors).

You could then sample the three choices for the computer, and work out a result before returning to the Result page.

</head>
<body>
<%= @player_name %>, the results are in!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants