personal-journal/app/controllers/admin/journal_paper_author_types_...

52 lines
1.2 KiB
Ruby

class Admin::JournalPaperAuthorTypesController < OrbitMemberController
before_action :allow_admin_only
before_action :set_journal_paper_author_type, only: [:edit, :update, :destroy]
def initialize
super
@app_type = 'journal_paper_author_type'
end
def new
@journal_author_type = JournalPaperAuthorType.new
end
def create
@journal_author_type = JournalPaperAuthorType.new(journal_paper_author_type_attributes)
respond_to do |format|
if @journal_author_type.save
format.js { render 'create_writing_journal_setting' }
end
end
end
def edit
end
def update
respond_to do |format|
if @journal_author_type.update_attributes(journal_paper_author_type_attributes)
format.js { render 'update_writing_journal_setting' }
end
end
end
def destroy
@journal_author_type.destroy
respond_to do |format|
format.js { render 'delete_journal_setting' }
end
end
private
def set_journal_paper_author_type
@journal_author_type = JournalPaperAuthorType.find(params[:id])
end
def journal_paper_author_type_attributes
params.require(:journal_paper_author_type).permit! rescue nil
end
end