personal-conference/app/controllers/admin/conference_author_types_con...

43 lines
1.1 KiB
Ruby

class Admin::ConferenceAuthorTypesController < OrbitMemberController
before_action :allow_admin_only
def new
@author_type = ConferenceAuthorType.new
@url = admin_conference_author_types_path(@author_type)
render :layout=>false
end
def create
@author_type = ConferenceAuthorType.new(author_type_params)
@author_type.save
@author_types = ConferenceAuthorType.all
render :partial=>'list', :layout=>false
end
def edit
@author_type = ConferenceAuthorType.find(params[:id])
@url = admin_conference_author_type_path(@author_type)
render :layout=>false
end
def update
@author_type = ConferenceAuthorType.find(params[:id])
@author_type.update_attributes(author_type_params)
@author_type.save
@author_types = ConferenceAuthorType.all
render :partial=>'list', :layout=>false
end
def destroy
author_type = ConferenceAuthorType.find(params[:id])
author_type.destroy
@author_types = ConferenceAuthorType.all
render :partial=>'list', :layout=>false
end
private
def author_type_params
params.require(:conference_author_type).permit! rescue nil
end
end