ensl.org/app/controllers/match_proposals_controller.rb

33 lines
752 B
Ruby
Raw Normal View History

2017-05-01 14:57:32 +00:00
class MatchProposalsController < ApplicationController
2017-05-01 14:57:32 +00:00
def index
2017-05-05 15:17:00 +00:00
@match = Match.find(params[:match_id])
2017-05-01 14:57:32 +00:00
end
def new
match = Match.find(params[:match_id])
@proposal = MatchProposal.new(match: match)
raise AccessError unless @proposal.can_create? cuser
2017-05-01 14:57:32 +00:00
end
def create
match = Match.find(params[:match_id])
@proposal = MatchProposal.new(match: match)
raise AccessError unless @ban.can_create? cuser
@proposal.team = cuser.team
@proposal.status = MatchProposal::STATUS_PENDING
@proposal.proposed_time = params[:match_proposal][:proposed_time]
if @proposal.save
flash[:notice] = 'Created new proposal'
redirect_to(match)
else
render :new
end
2017-05-01 14:57:32 +00:00
end
def update
end
2017-05-01 14:57:32 +00:00
end