2014-07-31 13:51:25 +00:00
|
|
|
class Admin::BookAuthorTypesController < OrbitMemberController
|
2015-01-09 07:38:49 +00:00
|
|
|
before_action :allow_admin_only
|
|
|
|
|
2014-07-03 07:48:28 +00:00
|
|
|
def new
|
2015-01-09 07:38:49 +00:00
|
|
|
@author_type = BookAuthorType.new
|
|
|
|
@url = admin_book_author_types_path(@author_type)
|
|
|
|
render :layout=>false
|
2014-07-03 07:48:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2015-01-09 07:38:49 +00:00
|
|
|
@author_type = BookAuthorType.new(author_type_params)
|
|
|
|
@author_type.save
|
|
|
|
@author_types = BookAuthorType.all
|
|
|
|
render :partial=>'list', :layout=>false
|
|
|
|
end
|
2014-07-03 07:48:28 +00:00
|
|
|
|
2015-01-09 07:38:49 +00:00
|
|
|
def edit
|
|
|
|
@author_type = BookAuthorType.find(params[:id])
|
|
|
|
@url = admin_book_author_type_path(@author_type)
|
|
|
|
render :layout=>false
|
2014-07-03 07:48:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2015-01-09 07:38:49 +00:00
|
|
|
@author_type = BookAuthorType.find(params[:id])
|
|
|
|
@author_type.update_attributes(author_type_params)
|
|
|
|
@author_type.save
|
|
|
|
@author_types = BookAuthorType.all
|
|
|
|
render :partial=>'list', :layout=>false
|
2014-07-03 07:48:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2015-01-09 07:38:49 +00:00
|
|
|
author_type = BookAuthorType.find(params[:id])
|
|
|
|
author_type.destroy
|
|
|
|
@author_types = BookAuthorType.all
|
|
|
|
render :partial=>'list', :layout=>false
|
2014-07-03 07:48:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2015-01-09 07:38:49 +00:00
|
|
|
def author_type_params
|
2014-07-03 07:48:28 +00:00
|
|
|
params.require(:book_author_type).permit! rescue nil
|
|
|
|
end
|
|
|
|
end
|