diff --git a/app/controllers/mats_controller.rb b/app/controllers/mats_controller.rb
index b1880f6..68470d3 100644
--- a/app/controllers/mats_controller.rb
+++ b/app/controllers/mats_controller.rb
@@ -1,10 +1,14 @@
class MatsController < ApplicationController
before_action :set_mat, only: [:show, :edit, :update, :destroy]
- before_filter :check_access, only: [:new,:create,:update,:destroy,:edit]
+ before_filter :check_access, only: [:new,:create,:update,:destroy,:edit,:show]
# GET /mats/1
# GET /mats/1.json
def show
+ @match = @mat.unfinishedMatches.first
+ @w1 = @match.wrestler1
+ @w2 = @match.wrestler2
+ @wrestlers = [@w1,@w2]
end
# GET /mats/new
diff --git a/app/views/mats/_match_edit_form.html.erb b/app/views/mats/_match_edit_form.html.erb
new file mode 100644
index 0000000..014f5cc
--- /dev/null
+++ b/app/views/mats/_match_edit_form.html.erb
@@ -0,0 +1,37 @@
+<%= form_for(@match) do |f| %>
+ <% if @match.errors.any? %>
+
+
<%= pluralize(@match.errors.count, "error") %> prohibited this match from being saved:
+
+
+ <% @match.errors.full_messages.each do |msg| %>
+ - <%= msg %>
+ <% end %>
+
+
+ <% end %>
+
+Bout <%= @match.bout_number %> <%= @w1.name %> VS. <%= @w2.name %>
+
+
+ <%= f.label "Win Type" %>
+ <%= f.select(:win_type, Match::WIN_TYPES) %>
+
+
+ <%= f.label "Winner" %> Please put in the id of the winner
+ <%= f.collection_select :winner_id, @wrestlers, :id, :name %>
+
+
+ <%= f.label "Score" %> Also put pin time here if applicable. If default or forfeit, leave blank
+ <%= f.text_field :score %>
+
+
+ <%= f.hidden_field :finished, :value => 1 %>
+ <%= f.hidden_field :round, :value => @match.round %>
+
+
+
+
+ <%= f.submit data: { confirm: "Did you confirm the winner before submitting? If not, please hit cancel."}, :class=>"btn btn-success" %>
+
+<% end %>
diff --git a/app/views/mats/show.html.erb b/app/views/mats/show.html.erb
index 9fa0b69..ae2b470 100644
--- a/app/views/mats/show.html.erb
+++ b/app/views/mats/show.html.erb
@@ -1,13 +1,19 @@
<%= notice %>
+<%= link_to "Back to #{@mat.tournament.name}", "/tournaments/#{@mat.tournament.id}", :class=>"btn btn-default" %>
+
+
- Name:
- <%= @mat.name %>
+ Mat <%= @mat.name %>
Tournament:
- <%= @mat.tournament_id %>
+ <%= @mat.tournament.name %>
-<%= link_to 'Edit', edit_mat_path(@mat) %> |
+
+
+
+<%= render 'match_edit_form' %>
+
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index e44e5e4..d4d02d5 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -128,7 +128,8 @@
<%= mat.name %> |
<% if tournament_permissions(@tournament) %>
- <%= link_to 'Destroy', mat, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
+ <%= link_to 'Show', mat, :class=>"btn btn-default" %>
+ <%= link_to 'Destroy', mat, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
<% end %>
|