52 lines
1.4 KiB
Ruby
52 lines
1.4 KiB
Ruby
class Admin::AcademicAdvisingTypesController < OrbitMemberController
|
|
before_action :allow_admin_only
|
|
|
|
def new
|
|
@academic_advising_type = AdvisingType.new
|
|
@url = admin_academic_advising_types_path(@academic_advising_type)
|
|
render :layout=>false
|
|
end
|
|
|
|
def create
|
|
@academic_advising_type = AdvisingType.new(academic_advising_type_params)
|
|
@academic_advising_type.save
|
|
@academic_advising_types = AdvisingType.all
|
|
render :partial=>'list', :layout=>false
|
|
end
|
|
|
|
def update_order
|
|
orders = params["order"]
|
|
AdvisingType.each do |ht|
|
|
ht.sort_position = orders["#{ht.id}"]
|
|
ht.save
|
|
end
|
|
render :json => {"success" => true}.to_json
|
|
end
|
|
|
|
def edit
|
|
@academic_advising_type = AdvisingType.find(params[:id])
|
|
@url = admin_academic_advising_type_path(@academic_advising_type)
|
|
render :layout=>false
|
|
end
|
|
|
|
def update
|
|
@academic_advising_type = AdvisingType.find(params[:id])
|
|
@academic_advising_type.update_attributes(academic_advising_type_params)
|
|
@academic_advising_type.save
|
|
@academic_advising_types = AdvisingType.all
|
|
render :partial=>'list', :layout=>false
|
|
end
|
|
|
|
def destroy
|
|
academic_advising_type = AdvisingType.find(params[:id])
|
|
academic_advising_type.destroy
|
|
@academic_advising_types = AdvisingType.all
|
|
render :partial=>'list', :layout=>false
|
|
end
|
|
|
|
private
|
|
|
|
def academic_advising_type_params
|
|
params.require(:advising_type).permit! rescue nil
|
|
end
|
|
end |