personal-journal1/app/controllers/admin/journal_levels_controller.rb

43 lines
1.0 KiB
Ruby
Raw Normal View History

2014-08-01 04:23:53 +00:00
class Admin::JournalLevelsController < OrbitMemberController
before_action :allow_admin_only
2015-01-09 07:30:13 +00:00
2014-06-12 10:27:26 +00:00
def new
2015-01-09 07:30:13 +00:00
@paper_level = JournalLevel.new
@url = admin_journal_levels_path(@paper_level)
render :layout=>false
2014-06-12 10:27:26 +00:00
end
def create
2015-01-09 07:30:13 +00:00
@paper_level = JournalLevel.new(paper_level_params)
@paper_level.save
@paper_levels = JournalLevel.all
render :partial=>'index', :layout=>false
2014-06-12 10:27:26 +00:00
end
def edit
2015-01-09 07:30:13 +00:00
@paper_level = JournalLevel.find(params[:id])
@url = admin_journal_level_path(@paper_level)
render :layout=>false
2014-06-12 10:27:26 +00:00
end
def update
2015-01-09 07:30:13 +00:00
@paper_level = JournalLevel.find(params[:id])
@paper_level.update_attributes(paper_level_params)
@paper_level.save
@paper_levels = JournalLevel.all
render :partial=>'index', :layout=>false
2014-06-12 10:27:26 +00:00
end
def destroy
2015-01-09 07:30:13 +00:00
paper_level = JournalLevel.find(params[:id])
paper_level.destroy
@paper_levels = JournalLevel.all
render :partial=>'index', :layout=>false
2014-06-12 10:27:26 +00:00
end
private
2015-01-09 07:30:13 +00:00
def paper_level_params
2014-06-12 10:27:26 +00:00
params.require(:journal_level).permit! rescue nil
end
2015-01-09 07:30:13 +00:00
end