From 433fc302fe2943e89a36657affea39d578475d20 Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Tue, 25 Mar 2014 17:47:32 -0400 Subject: Match Status added --- app/controllers/matches_controller.rb | 2 +- app/views/matches/_form.html.erb | 4 ++++ app/views/matches/index.html.erb | 2 ++ app/views/matches/index.json.jbuilder | 2 +- app/views/matches/show.html.erb | 5 +++++ app/views/matches/show.json.jbuilder | 2 +- 6 files changed, 14 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 8329da5..d79a7fc 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -69,6 +69,6 @@ class MatchesController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def match_params - params.require(:match).permit(:tournament_id, :name, :winner_id) + params.require(:match).permit(:status, :tournament_id, :name, :winner_id) end end diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb index f1e6047..727c002 100644 --- a/app/views/matches/_form.html.erb +++ b/app/views/matches/_form.html.erb @@ -11,6 +11,10 @@ <% end %> +
+ <%= f.label :status %>
+ <%= f.number_field :status %> +
<%= f.label :tournament_id %>
<%= f.text_field :tournament_id %> diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 71db08c..400efb4 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -3,6 +3,7 @@ + @@ -15,6 +16,7 @@ <% @matches.each do |match| %> + diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder index 0b2bfcd..1a63f5f 100644 --- a/app/views/matches/index.json.jbuilder +++ b/app/views/matches/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@matches) do |match| - json.extract! match, :id, :tournament_id, :name, :winner_id + json.extract! match, :id, :status, :tournament_id, :name, :winner_id json.url match_url(match, format: :json) end diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 3abb1f7..f3fc822 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -1,5 +1,10 @@

<%= notice %>

+

+ Status: + <%= @match.status %> +

+

Tournament: <%= @match.tournament %> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder index fe14010..a3ef588 100644 --- a/app/views/matches/show.json.jbuilder +++ b/app/views/matches/show.json.jbuilder @@ -1 +1 @@ -json.extract! @match, :id, :tournament_id, :name, :winner_id, :created_at, :updated_at +json.extract! @match, :id, :status, :tournament_id, :name, :winner_id, :created_at, :updated_at -- cgit v1.2.3

Status Tournament Name Winner
<%= match.status %> <%= match.tournament %> <%= match.name %> <%= match.winner %>