Class: Cfp::ProposalsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/cfp/proposals_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
# File 'app/controllers/cfp/proposals_controller.rb', line 15

def create
  @proposal = Proposal.new proposal_params[:proposal]
  @proposal.user = current_user
  if @proposal.save
    redirect_to :proposals, :notice => t('proposals.created.success')
  else
    render :action => :new
  end
end

#destroyObject



36
37
38
39
# File 'app/controllers/cfp/proposals_controller.rb', line 36

def destroy
  @proposal.destroy if @proposal.can_be_edited_by?(current_user)
  redirect_to :proposals, :notice => t('proposals.deleted.success')
end

#editObject



25
26
# File 'app/controllers/cfp/proposals_controller.rb', line 25

def edit
end

#indexObject



7
8
9
# File 'app/controllers/cfp/proposals_controller.rb', line 7

def index
  @proposals = Proposal.scoped_for(current_user)
end

#newObject



11
12
13
# File 'app/controllers/cfp/proposals_controller.rb', line 11

def new
  @proposal = Proposal.new
end

#updateObject



28
29
30
31
32
33
34
# File 'app/controllers/cfp/proposals_controller.rb', line 28

def update
  if @proposal.can_be_edited_by?(current_user) && @proposal.update_attributes(proposal_params[:proposal])
    redirect_to :proposals, :notice => t('proposals.edited.success')
  else
    render :action => "edit"
  end
end