mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-14 05:41:00 +00:00
34 lines
715 B
Ruby
34 lines
715 B
Ruby
class MatchProposalsController < ApplicationController
|
|
before_filter :get_match
|
|
def index
|
|
end
|
|
|
|
def new
|
|
@proposal = MatchProposal.new
|
|
@proposal.match = @match
|
|
raise AccessError unless @proposal.can_create? cuser
|
|
end
|
|
|
|
def create
|
|
@proposal = MatchProposal.new(params[:match_proposal])
|
|
@proposal.match = @match
|
|
raise AccessError unless @proposal.can_create? cuser
|
|
@proposal.team = cuser.team
|
|
@proposal.status = MatchProposal::STATUS_PENDING
|
|
|
|
if @proposal.save!
|
|
flash[:notice] = 'Created new proposal'
|
|
redirect_to(@match)
|
|
else
|
|
render :new
|
|
end
|
|
end
|
|
|
|
def update
|
|
end
|
|
|
|
private
|
|
def get_match
|
|
@match = Match.find params[:match_id]
|
|
end
|
|
end
|