diff --git a/app/assets/javascripts/mats.js.coffee b/app/assets/javascripts/mats.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/mats.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/mats.css.scss b/app/assets/stylesheets/mats.css.scss new file mode 100644 index 0000000..92a20d9 --- /dev/null +++ b/app/assets/stylesheets/mats.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Mats controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index eb1a87f..7bcefe4 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -19,11 +19,26 @@ class MatchesController < ApplicationController # GET /matches/1/edit def edit + if user_signed_in? + else + redirect_to root_path + end + if params[:match] + @match = Match.find (params[:match]) + end + if @match + @w1 = Wrestler.find(@match.r_id) + @w2 = Wrestler.find(@match.g_id) + end end # POST /matches # POST /matches.json def create + if user_signed_in? + else + redirect_to root_path + end @match = Match.new(match_params) respond_to do |format| @@ -40,9 +55,13 @@ class MatchesController < ApplicationController # PATCH/PUT /matches/1 # PATCH/PUT /matches/1.json def update + if user_signed_in? + else + redirect_to root_path + end respond_to do |format| if @match.update(match_params) - format.html { redirect_to @match, notice: 'Match was successfully updated.' } + format.html { redirect_to root_path, notice: 'Match was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } @@ -54,6 +73,10 @@ class MatchesController < ApplicationController # DELETE /matches/1 # DELETE /matches/1.json def destroy + if user_signed_in? + else + redirect_to root_path + end @match.destroy respond_to do |format| format.html { redirect_to matches_url } @@ -69,6 +92,6 @@ class MatchesController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def match_params - params.require(:match).permit(:r_id, :g_id, :g_stat, :r_stat, :winner_id, :win_type, :score) + params.require(:match).permit(:r_id, :g_id, :g_stat, :r_stat, :winner_id, :win_type, :score, :finished) end end diff --git a/app/controllers/mats_controller.rb b/app/controllers/mats_controller.rb new file mode 100644 index 0000000..fbe955f --- /dev/null +++ b/app/controllers/mats_controller.rb @@ -0,0 +1,93 @@ +class MatsController < ApplicationController + before_action :set_mat, only: [:show, :edit, :update, :destroy] + + # GET /mats + # GET /mats.json + def index + @mats = Mat.all + end + + # GET /mats/1 + # GET /mats/1.json + def show + end + + # GET /mats/new + def new + @mat = Mat.new + if params[:tournament] + @tournament_field = params[:tournament] + @tournament = Tournament.find(params[:tournament]) + end + end + + # GET /mats/1/edit + def edit + @tournament_field = @mat.tournament_id + end + + # POST /mats + # POST /mats.json + def create + if user_signed_in? + else + redirect_to root_path + end + @mat = Mat.new(mat_params) + @tournament = Tournament.find(mat_params[:tournament_id]) + respond_to do |format| + if @mat.save + format.html { redirect_to @tournament, notice: 'Mat was successfully created.' } + format.json { render action: 'show', status: :created, location: @mat } + else + format.html { render action: 'new' } + format.json { render json: @mat.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /mats/1 + # PATCH/PUT /mats/1.json + def update + if user_signed_in? + else + redirect_to root_path + end + @tournament = Tournament.find(@mat.tournament_id) + respond_to do |format| + if @mat.update(mat_params) + format.html { redirect_to @tournament, notice: 'Mat was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: 'edit' } + format.json { render json: @mat.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /mats/1 + # DELETE /mats/1.json + def destroy + if user_signed_in? + else + redirect_to root_path + end + @tournament = Tournament.find(@mat.tournament_id) + @mat.destroy + respond_to do |format| + format.html { redirect_to @tournament } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_mat + @mat = Mat.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def mat_params + params.require(:mat).permit(:name, :tournament_id) + end +end diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index 826426e..5902334 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -31,6 +31,10 @@ class SchoolsController < ApplicationController # POST /schools # POST /schools.json def create + if user_signed_in? + else + redirect_to root_path + end @school = School.new(school_params) @tournament = Tournament.find(school_params[:tournament_id]) respond_to do |format| @@ -47,6 +51,10 @@ class SchoolsController < ApplicationController # PATCH/PUT /schools/1 # PATCH/PUT /schools/1.json def update + if user_signed_in? + else + redirect_to root_path + end @tournament = Tournament.find(@school.tournament_id) respond_to do |format| if @school.update(school_params) @@ -62,6 +70,10 @@ class SchoolsController < ApplicationController # DELETE /schools/1 # DELETE /schools/1.json def destroy + if user_signed_in? + else + redirect_to root_path + end @tournament = Tournament.find(@school.tournament_id) @school.destroy respond_to do |format| diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index fc9a0c3..5449549 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -3,7 +3,25 @@ class StaticPagesController < ApplicationController def index @tournaments = Tournament.all end + def up_matches + if params[:tournament] + @tournament = Tournament.find(params[:tournament]) + end + if @tournament + @matches = Weight.where(tournament_id: @tournament.id) + end + @matches = Match.where(finished: nil) + end + def results + if params[:tournament] + @tournament = Tournament.find(params[:tournament]) + end + if @tournament + @matches = Weight.where(tournament_id: @tournament.id) + end + @matches = Match.where(finished: 1) + end def brackets if params[:weight] @weight = Weight.find(params[:weight]) @@ -33,5 +51,226 @@ class StaticPagesController < ApplicationController @weights = Weight.where(tournament_id: @tournament.id) end end + + def generate_matches + if user_signed_in? + else + redirect_to root_path + end + if params[:tournament] + @tournament = Tournament.find(params[:tournament]) + end + if @tournament + @matches_all = Match.where(tournament_id: @tournament.id) + @matches_all.each do |match| + match.destroy + end + @weights = Weight.where(tournament_id: @tournament.id) + #ROUND 1 + @weights.order("id asc").each do |weight| + @seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first + @seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first + @seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first + @seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first + @seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first + @seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first + @seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first + @seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first + @seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first + @seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first + @bracket_size = Wrestler.where(weight_id: weight.id).count + def createMatch(r_id,g_id,tournament) + @match = Match.new + @match.r_id = r_id + @match.g_id = g_id + @match.tournament_id = tournament + @match.round = 1 + @match.save + end + if @bracket_size == 10 + createMatch(@seed1.id,@seed10.id,@tournament.id) + createMatch(@seed5.id,@seed7.id,@tournament.id) + createMatch(@seed2.id,@seed9.id,@tournament.id) + createMatch(@seed6.id,@seed8.id,@tournament.id) + elsif @bracket_size == 9 + createMatch(@seed1.id,@seed9.id,@tournament.id) + createMatch(@seed5.id,@seed7.id,@tournament.id) + createMatch(@seed6.id,@seed8.id,@tournament.id) + elsif @bracket_size == 8 + createMatch(@seed5.id,@seed7.id,@tournament.id) + createMatch(@seed6.id,@seed8.id,@tournament.id) + elsif @bracket_size == 7 + createMatch(@seed5.id,@seed7.id,@tournament.id) + end + + end + #ROUND 2 + @weights.order("id asc").each do |weight| + @seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first + @seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first + @seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first + @seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first + @seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first + @seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first + @seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first + @seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first + @seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first + @seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first + @bracket_size = Wrestler.where(weight_id: weight.id).count + def createMatch(r_id,g_id,tournament) + @match = Match.new + @match.r_id = r_id + @match.g_id = g_id + @match.tournament_id = tournament + @match.round = 2 + @match.save + end + if @bracket_size == 10 + createMatch(@seed1.id,@seed5.id,@tournament.id) + createMatch(@seed10.id,@seed4.id,@tournament.id) + createMatch(@seed2.id,@seed6.id,@tournament.id) + createMatch(@seed9.id,@seed3.id,@tournament.id) + elsif @bracket_size == 9 + createMatch(@seed1.id,@seed5.id,@tournament.id) + createMatch(@seed9.id,@seed4.id,@tournament.id) + createMatch(@seed2.id,@seed6.id,@tournament.id) + elsif @bracket_size == 8 + createMatch(@seed1.id,@seed5.id,@tournament.id) + createMatch(@seed2.id,@seed6.id,@tournament.id) + elsif @bracket_size == 7 + createMatch(@seed1.id,@seed5.id,@tournament.id) + createMatch(@seed2.id,@seed6.id,@tournament.id) + end + + end + #ROUND 3 + @weights.order("id asc").each do |weight| + @seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first + @seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first + @seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first + @seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first + @seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first + @seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first + @seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first + @seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first + @seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first + @seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first + @bracket_size = Wrestler.where(weight_id: weight.id).count + def createMatch(r_id,g_id,tournament) + @match = Match.new + @match.r_id = r_id + @match.g_id = g_id + @match.tournament_id = tournament + @match.round = 3 + @match.save + end + if @bracket_size == 10 + createMatch(@seed1.id,@seed4.id,@tournament.id) + createMatch(@seed10.id,@seed7.id,@tournament.id) + createMatch(@seed2.id,@seed3.id,@tournament.id) + createMatch(@seed8.id,@seed9.id,@tournament.id) + elsif @bracket_size == 9 + createMatch(@seed1.id,@seed4.id,@tournament.id) + createMatch(@seed9.id,@seed7.id,@tournament.id) + createMatch(@seed2.id,@seed3.id,@tournament.id) + elsif @bracket_size == 8 + createMatch(@seed1.id,@seed4.id,@tournament.id) + createMatch(@seed2.id,@seed3.id,@tournament.id) + elsif @bracket_size == 7 + createMatch(@seed1.id,@seed4.id,@tournament.id) + createMatch(@seed2.id,@seed3.id,@tournament.id) + end + + end + #ROUND 4 + @weights.order("id asc").each do |weight| + @seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first + @seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first + @seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first + @seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first + @seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first + @seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first + @seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first + @seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first + @seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first + @seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first + @bracket_size = Wrestler.where(weight_id: weight.id).count + def createMatch(r_id,g_id,tournament) + @match = Match.new + @match.r_id = r_id + @match.g_id = g_id + @match.tournament_id = tournament + @match.round = 4 + @match.save + end + if @bracket_size == 10 + createMatch(@seed1.id,@seed7.id,@tournament.id) + createMatch(@seed5.id,@seed4.id,@tournament.id) + createMatch(@seed2.id,@seed8.id,@tournament.id) + createMatch(@seed6.id,@seed3.id,@tournament.id) + elsif @bracket_size == 9 + createMatch(@seed1.id,@seed7.id,@tournament.id) + createMatch(@seed5.id,@seed4.id,@tournament.id) + createMatch(@seed2.id,@seed8.id,@tournament.id) + createMatch(@seed6.id,@seed3.id,@tournament.id) + elsif @bracket_size == 8 + createMatch(@seed1.id,@seed7.id,@tournament.id) + createMatch(@seed5.id,@seed4.id,@tournament.id) + createMatch(@seed2.id,@seed8.id,@tournament.id) + createMatch(@seed6.id,@seed3.id,@tournament.id) + elsif @bracket_size == 7 + createMatch(@seed1.id,@seed7.id,@tournament.id) + createMatch(@seed5.id,@seed4.id,@tournament.id) + createMatch(@seed6.id,@seed3.id,@tournament.id) + end + + end + #ROUND 5 + @weights.order("id asc").each do |weight| + @seed1 = Wrestler.where(weight_id: weight.id, original_seed: 1).first + @seed10 = Wrestler.where(weight_id: weight.id, original_seed: 10).first + @seed7 = Wrestler.where(weight_id: weight.id, original_seed: 7).first + @seed5 = Wrestler.where(weight_id: weight.id, original_seed: 5).first + @seed4 = Wrestler.where(weight_id: weight.id, original_seed: 4).first + @seed2 = Wrestler.where(weight_id: weight.id, original_seed: 2).first + @seed9 = Wrestler.where(weight_id: weight.id, original_seed: 9).first + @seed6 = Wrestler.where(weight_id: weight.id, original_seed: 6).first + @seed8 = Wrestler.where(weight_id: weight.id, original_seed: 8).first + @seed3 = Wrestler.where(weight_id: weight.id, original_seed: 3).first + @bracket_size = Wrestler.where(weight_id: weight.id).count + def createMatch(r_id,g_id,tournament) + @match = Match.new + @match.r_id = r_id + @match.g_id = g_id + @match.tournament_id = tournament + @match.round = 5 + @match.save + end + if @bracket_size == 10 + createMatch(@seed10.id,@seed5.id,@tournament.id) + createMatch(@seed7.id,@seed4.id,@tournament.id) + createMatch(@seed9.id,@seed6.id,@tournament.id) + createMatch(@seed8.id,@seed3.id,@tournament.id) + elsif @bracket_size == 9 + createMatch(@seed7.id,@seed4.id,@tournament.id) + createMatch(@seed9.id,@seed5.id,@tournament.id) + createMatch(@seed8.id,@seed3.id,@tournament.id) + elsif @bracket_size == 8 + createMatch(@seed7.id,@seed4.id,@tournament.id) + createMatch(@seed8.id,@seed3.id,@tournament.id) + elsif @bracket_size == 7 + createMatch(@seed7.id,@seed4.id,@tournament.id) + end + + end + end + + end + + + + + + end diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index db76c55..525e0cb 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -12,6 +12,7 @@ class TournamentsController < ApplicationController def show @schools = @tournament.schools @weights = @tournament.weights + @mats = @tournament.mats end # GET /tournaments/new @@ -26,6 +27,10 @@ class TournamentsController < ApplicationController # POST /tournaments # POST /tournaments.json def create + if user_signed_in? + else + redirect_to root_path + end @tournament = Tournament.new(tournament_params) respond_to do |format| if @tournament.save @@ -41,6 +46,10 @@ class TournamentsController < ApplicationController # PATCH/PUT /tournaments/1 # PATCH/PUT /tournaments/1.json def update + if user_signed_in? + else + redirect_to root_path + end respond_to do |format| if @tournament.update(tournament_params) format.html { redirect_to @tournament, notice: 'Tournament was successfully updated.' } @@ -55,6 +64,10 @@ class TournamentsController < ApplicationController # DELETE /tournaments/1 # DELETE /tournaments/1.json def destroy + if user_signed_in? + else + redirect_to root_path + end @tournament.destroy respond_to do |format| format.html { redirect_to tournaments_url } diff --git a/app/controllers/weights_controller.rb b/app/controllers/weights_controller.rb index 906bdca..3aba682 100644 --- a/app/controllers/weights_controller.rb +++ b/app/controllers/weights_controller.rb @@ -21,16 +21,22 @@ class WeightsController < ApplicationController @tournament_field = params[:tournament] @tournament = Tournament.find(params[:tournament]) end + @mats = Mat.where(tournament_id: @tournament.id) end # GET /weights/1/edit def edit @tournament_field = @weight.tournament_id + @mats = Mat.where(tournament_id: @weight.tournament.id) end # POST /weights # POST /weights.json def create + if user_signed_in? + else + redirect_to root_path + end @weight = Weight.new(weight_params) @tournament = Tournament.find(weight_params[:tournament_id]) respond_to do |format| @@ -47,6 +53,10 @@ class WeightsController < ApplicationController # PATCH/PUT /weights/1 # PATCH/PUT /weights/1.json def update + if user_signed_in? + else + redirect_to root_path + end @tournament = Tournament.find(@weight.tournament_id) respond_to do |format| if @weight.update(weight_params) @@ -62,6 +72,10 @@ class WeightsController < ApplicationController # DELETE /weights/1 # DELETE /weights/1.json def destroy + if user_signed_in? + else + redirect_to root_path + end @tournament = Tournament.find(@weight.tournament_id) @weight.destroy respond_to do |format| @@ -78,6 +92,6 @@ class WeightsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def weight_params - params.require(:weight).permit(:max, :tournament_id) + params.require(:weight).permit(:max, :tournament_id, :mat_id) end end diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index bc6c8ef..7e09100 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -43,6 +43,10 @@ class WrestlersController < ApplicationController # POST /wrestlers # POST /wrestlers.json def create + if user_signed_in? + else + redirect_to root_path + end @wrestler = Wrestler.new(wrestler_params) @school = School.find(wrestler_params[:school_id]) respond_to do |format| @@ -59,6 +63,10 @@ class WrestlersController < ApplicationController # PATCH/PUT /wrestlers/1 # PATCH/PUT /wrestlers/1.json def update + if user_signed_in? + else + redirect_to root_path + end @school = School.find(@wrestler.school_id) respond_to do |format| if @wrestler.update(wrestler_params) @@ -74,6 +82,10 @@ class WrestlersController < ApplicationController # DELETE /wrestlers/1 # DELETE /wrestlers/1.json def destroy + if user_signed_in? + else + redirect_to root_path + end @school = School.find(@wrestler.school_id) @wrestler.destroy respond_to do |format| diff --git a/app/helpers/mats_helper.rb b/app/helpers/mats_helper.rb new file mode 100644 index 0000000..00d3f97 --- /dev/null +++ b/app/helpers/mats_helper.rb @@ -0,0 +1,2 @@ +module MatsHelper +end diff --git a/app/models/mat.rb b/app/models/mat.rb new file mode 100644 index 0000000..7399548 --- /dev/null +++ b/app/models/mat.rb @@ -0,0 +1,4 @@ +class Mat < ActiveRecord::Base + belongs_to :tournament + has_many :weights, dependent: :destroy +end diff --git a/app/models/match.rb b/app/models/match.rb index d63c787..f5f8ffb 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -1,3 +1,4 @@ class Match < ActiveRecord::Base belongs_to :tournament + WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default"] end diff --git a/app/models/school.rb b/app/models/school.rb index dee553a..97585d0 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -3,11 +3,27 @@ class School < ActiveRecord::Base has_many :wrestlers, dependent: :destroy #calculate score here - #def score - # @score = 0 - # self.wrestlers.each do |w| - # @score = @score + w.season_win * 2 - # end - # self.score = @score - #end + def score + @score = 0 + self.wrestlers.each do |wrestler| + @match_wins = Match.where(winner_id: wrestler.id) + @match_wins.each do |m| + @score = @score + 2 + if m.win_type == "Major" + @score = @score + 1 + elsif m.win_type == "Tech Fall" + @score = @score + 1.5 + elsif m.win_type == "Pin" + @score = @score + 2 + elsif m.win_type == "Forfeit" + @score = @score + 2 + elsif m.win_type == "Injury Default" + @score = @score + 2 + elsif m.win_type == "Default" + @score = @score + 2 + end + end + end + self.score = @score + end end diff --git a/app/models/tournament.rb b/app/models/tournament.rb index 4b3c4ed..93f4ed5 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -2,5 +2,5 @@ class Tournament < ActiveRecord::Base has_many :schools, dependent: :destroy has_many :weights, dependent: :destroy has_many :matches, dependent: :destroy - + has_many :mats, dependent: :destroy end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 56fa9d4..6961cc7 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -7,7 +7,8 @@
| Name | +Tournament | ++ | + | + |
|---|---|---|---|---|
| <%= mat.name %> | +<%= mat.tournament_id %> | +<%= link_to 'Show', mat %> | +<%= link_to 'Edit', edit_mat_path(mat) %> | +<%= link_to 'Destroy', mat, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Name: + <%= @mat.name %> +
+ ++ Tournament: + <%= @mat.tournament_id %> +
+ +<%= link_to 'Edit', edit_mat_path(@mat) %> | diff --git a/app/views/mats/show.json.jbuilder b/app/views/mats/show.json.jbuilder new file mode 100644 index 0000000..fbf6872 --- /dev/null +++ b/app/views/mats/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @mat, :id, :name, :tournament_id, :created_at, :updated_at diff --git a/app/views/static_pages/_man10.html.erb b/app/views/static_pages/_man10.html.erb index a0dc68b..032d899 100644 --- a/app/views/static_pages/_man10.html.erb +++ b/app/views/static_pages/_man10.html.erb @@ -1,4 +1,4 @@ -| Name | ++ |
|---|---|
| <%= mat.name %> | ++ <% if user_signed_in? %> + <%= link_to 'Destroy', mat, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %> + <% end %> + | +