2017-05-01 14:57:32 +00:00
|
|
|
class MatchProposalsController < ApplicationController
|
2017-05-11 20:26:18 +00:00
|
|
|
|
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
|
2017-05-11 20:26:18 +00:00
|
|
|
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
|
2017-05-11 20:26:18 +00:00
|
|
|
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
|
2017-05-11 20:26:18 +00:00
|
|
|
|
|
|
|
def update
|
|
|
|
end
|
|
|
|
|
2017-05-01 14:57:32 +00:00
|
|
|
end
|