运营人员放开培训会的页面

dev_aliyun
daiao 5 years ago
parent 81eecec549
commit 784955cbf4

@ -100,26 +100,23 @@ class ManagementsController < ApplicationController
@pay_type = params[:pay_type] @pay_type = params[:pay_type]
@page = params[:page] || 1 @page = params[:page] || 1
@status = params[:status] @status = params[:status]
if User.current.admin? @trainings = Training.includes(:training_payinfo)
@trainings = Training.includes(:training_payinfo) if params[:search] && params[:search].strip != ""
if params[:search] && params[:search].strip != "" @trainings = @trainings.where("trainings.name like '%#{params[:search]}%'")
@trainings = @trainings.where("trainings.name like '%#{params[:search]}%'")
end
if params[:training_type] && params[:training_type].to_i != -1
@trainings = @trainings.where("training_type = #{params[:training_type]}")
end
if params[:pay_type] && params[:pay_type].to_i != -1
@trainings = @trainings.where("training_payinfos.pay_type = #{params[:pay_type]}")
end
if params[:status] && params[:status].to_i != -1
@trainings = @trainings.where("training_payinfos.status = #{params[:status]}")
end
@page = params[:page] || 1
@all_trainings = @trainings.reorder("trainings.created_at desc")
@trainings = paginateHelper @trainings.reorder("trainings.created_at desc"), 50
else
render_403
end end
if params[:training_type] && params[:training_type].to_i != -1
@trainings = @trainings.where("training_type = #{params[:training_type]}")
end
if params[:pay_type] && params[:pay_type].to_i != -1
@trainings = @trainings.where("training_payinfos.pay_type = #{params[:pay_type]}")
end
if params[:status] && params[:status].to_i != -1
@trainings = @trainings.where("training_payinfos.status = #{params[:status]}")
end
@page = params[:page] || 1
@all_trainings = @trainings.reorder("trainings.created_at desc")
@trainings = paginateHelper @trainings.reorder("trainings.created_at desc"), 50
respond_to do |format| respond_to do |format|
format.js format.js
format.html format.html

Loading…
Cancel
Save