44 lines
1.2 KiB
Ruby
44 lines
1.2 KiB
Ruby
class Admin::JournalPaperAuthorTypesController < OrbitMemberController
|
|
before_action :allow_admin_only
|
|
|
|
def new
|
|
@author_type = JournalPaperAuthorType.new
|
|
@url = admin_journal_paper_author_types_path(@author_type)
|
|
render :layout=>false
|
|
end
|
|
|
|
def create
|
|
@author_type = JournalPaperAuthorType.new(author_type_params)
|
|
@author_type.save
|
|
@author_types = JournalPaperAuthorType.all
|
|
render :partial=>'list', :layout=>false
|
|
end
|
|
|
|
def edit
|
|
@author_type = JournalPaperAuthorType.find(params[:id])
|
|
@url = admin_journal_paper_author_type_path(@author_type)
|
|
render :layout=>false
|
|
end
|
|
|
|
def update
|
|
@author_type = JournalPaperAuthorType.find(params[:id])
|
|
@author_type.update_attributes(author_type_params)
|
|
@author_type.save
|
|
@author_types = JournalPaperAuthorType.all
|
|
render :partial=>'list', :layout=>false
|
|
end
|
|
|
|
def destroy
|
|
author_type = JournalPaperAuthorType.find(params[:id])
|
|
author_type.destroy
|
|
@author_types = JournalPaperAuthorType.all
|
|
render :partial=>'list', :layout=>false
|
|
end
|
|
|
|
private
|
|
|
|
def author_type_params
|
|
params.require(:journal_paper_author_type).permit! rescue nil
|
|
end
|
|
end
|