2014-08-01 04:23:53 +00:00
|
|
|
class Admin::JournalLevelsController < OrbitMemberController
|
|
|
|
before_action :allow_admin_only
|
2014-06-12 10:27:26 +00:00
|
|
|
before_action :set_journal_level, only: [:edit, :update, :destroy]
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super
|
|
|
|
@app_type = 'journal_level'
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
@journal_level = JournalLevel.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@journal_level = JournalLevel.new(journal_level_attributes)
|
|
|
|
respond_to do |format|
|
|
|
|
if @journal_level.save
|
|
|
|
format.js { render 'create_writing_journal_setting' }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
respond_to do |format|
|
|
|
|
if @journal_level.update_attributes(journal_level_attributes)
|
|
|
|
format.js { render 'update_writing_journal_setting' }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@journal_level.destroy
|
|
|
|
respond_to do |format|
|
|
|
|
format.js { render 'delete_journal_setting' }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_journal_level
|
|
|
|
@journal_level = JournalLevel.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def journal_level_attributes
|
|
|
|
params.require(:journal_level).permit! rescue nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|