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

44 lines
1.2 KiB
Ruby
Raw Normal View History

2014-08-01 04:23:53 +00:00
class Admin::JournalPaperAuthorTypesController < 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
@author_type = JournalPaperAuthorType.new
@url = admin_journal_paper_author_types_path(@author_type)
render :layout=>false
2014-06-12 10:27:26 +00:00
end
def create
2015-01-09 07:30:13 +00:00
@author_type = JournalPaperAuthorType.new(author_type_params)
@author_type.save
@author_types = JournalPaperAuthorType.all
render :partial=>'list', :layout=>false
2014-06-12 10:27:26 +00:00
end
def edit
2015-01-09 07:30:13 +00:00
@author_type = JournalPaperAuthorType.find(params[:id])
@url = admin_journal_paper_author_type_path(@author_type)
render :layout=>false
2014-06-12 10:27:26 +00:00
end
def update
2015-01-09 07:30:13 +00:00
@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
2014-06-12 10:27:26 +00:00
end
def destroy
2015-01-09 07:30:13 +00:00
author_type = JournalPaperAuthorType.find(params[:id])
author_type.destroy
@author_types = JournalPaperAuthorType.all
render :partial=>'list', :layout=>false
2014-06-12 10:27:26 +00:00
end
private
2015-01-09 07:30:13 +00:00
def author_type_params
2014-06-12 10:27:26 +00:00
params.require(:journal_paper_author_type).permit! rescue nil
end
end