personal-conference/app/controllers/admin/conference_paper_levels_con...

43 lines
1.1 KiB
Ruby

class Admin::ConferencePaperLevelsController < OrbitMemberController
before_action :allow_admin_only
def new
@paper_level = ConferencePaperLevel.new
@url = admin_conference_paper_levels_path(@paper_level)
render :layout=>false
end
def create
@paper_level = ConferencePaperLevel.new(paper_level_params)
@paper_level.save
@paper_levels = ConferencePaperLevel.all
render :partial=>'index', :layout=>false
end
def edit
@paper_level = ConferencePaperLevel.find(params[:id])
@url = admin_conference_paper_level_path(@paper_level)
render :layout=>false
end
def update
@paper_level = ConferencePaperLevel.find(params[:id])
@paper_level.update_attributes(paper_level_params)
@paper_level.save
@paper_levels = ConferencePaperLevel.all
render :partial=>'index', :layout=>false
end
def destroy
paper_level = ConferencePaperLevel.find(params[:id])
paper_level.destroy
@paper_levels = ConferencePaperLevel.all
render :partial=>'index', :layout=>false
end
private
def paper_level_params
params.require(:conference_paper_level).permit! rescue nil
end
end