Skip to content

Commit

Permalink
added index and show views for Guess
Browse files Browse the repository at this point in the history
  • Loading branch information
dladowitz committed Oct 6, 2012
1 parent d03a5df commit 450bbd2
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 deletions.
13 changes: 12 additions & 1 deletion app/controllers/guesses_controller.rb
@@ -1,11 +1,22 @@
class GuessesController < ApplicationController class GuessesController < ApplicationController

def index
@guesses = Guess.all
end

def new def new
@guess = Guess.new @guess = Guess.new
end end


def create def create
@guess = Guess.create(params[:guess]) @guess = Guess.create(params[:guess])
redirect_to new_guess_path redirect_to @guess
end end


def show
@guess = Guess.find(params[:id])
@pop_state = PopulationState.find(1)
end


end end
25 changes: 25 additions & 0 deletions app/views/guesses/index.html.haml
@@ -0,0 +1,25 @@
%h3 Miss Cleo's past perdictions

%table.table-striped#guess_table
%thead
%tr
%th Name
%th Height
%th Weight
%th Prediction

- @guesses.each do |guess|
%tr
%td= guess.name
%td= guess.height
%td= guess.weight
%td= guess.sex
%td
.span.label.label-success
= link_to 'View', guess


%br

.span.label.label-inverse#person_button
= link_to 'New Guess', new_guess_path
18 changes: 18 additions & 0 deletions app/views/guesses/show.html.haml
@@ -0,0 +1,18 @@
%p#notice= notice

%p
%b Name:
= @guess.name
%p
%b Height:
= @guess.height
%p
%b Weight:
= @guess.weight
%p
%b Miss Cleo thinks this person is a:
= @pop_state.guess



= link_to 'Back', new_guess_path
7 changes: 5 additions & 2 deletions app/views/layouts/application.html.erb
Expand Up @@ -13,8 +13,11 @@
<%= link_to "Miss Cleo", root_path, class: 'brand' %> <%= link_to "Miss Cleo", root_path, class: 'brand' %>
<ul class="nav"> <ul class="nav">


<li class="dropdown"> <li>
<%= link_to "Guess", new_guess_path %> <%= link_to "New Guess", new_guess_path %>
</li>
<li >
<%= link_to "Past Guesses", guesses_path %>
</li> </li>
</ul> </ul>
</div> </div>
Expand Down

0 comments on commit 450bbd2

Please sign in to comment.