Skip to content

Commit

Permalink
Added setup error messages to index view
Browse files Browse the repository at this point in the history
  • Loading branch information
lisahamm committed Feb 26, 2015
1 parent 5f31688 commit 1e93c0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions public/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ input#setup-submit {
width: 80px;
}

#setup-form p {
#setup-form div.error {
color: red;
font-size: 0.9em;
font-size: 0.8em;
font-weight: 300;
margin: 5px;
}
Expand Down
18 changes: 12 additions & 6 deletions views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
<input type="radio" name="player_mark" value="O" />O
</div>

<% if params[:player_mark] == {} %>
<p><%= @invalid_input_messages[:player_mark] %></p>
<% if flash[:errors] %>
<div class="error">
<p>*<%= flash[:errors].fetch(:player_mark) %></p>
</div>
<% end %>

<div class="form-section">
Expand All @@ -17,8 +19,10 @@
<input type="radio" name="opponent" value="no" />No
</div>

<% if params[:opponent] == nil %>
<p><%= @invalid_input_messages[:opponent] %></p>
<% if flash[:errors] %>
<div class="error">
<p>*<%= flash[:errors].fetch(:opponent) %></p>
</div>
<% end %>

<div class="form-section">
Expand All @@ -27,8 +31,10 @@
<input type="radio" name="player_order" value="second" />Second
</div>

<% if params[:player_order] == nil %>
<p><%= @invalid_input_messages[:player_order] %></p>
<% if flash[:errors] %>
<div class="error">
<p>*<%= flash[:errors].fetch(:player_order) %></p>
</div>
<% end %>

<div class="form-section">
Expand Down

0 comments on commit 1e93c0e

Please sign in to comment.