From 784955cbf48f49d357bde3d731ad378e2a25560c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 3 Aug 2019 14:01:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=90=A5=E4=BA=BA=E5=91=98=E6=94=BE?= =?UTF-8?q?=E5=BC=80=E5=9F=B9=E8=AE=AD=E4=BC=9A=E7=9A=84=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 35 +++++++++++------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 1dbed521..d946c12b 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -100,26 +100,23 @@ class ManagementsController < ApplicationController @pay_type = params[:pay_type] @page = params[:page] || 1 @status = params[:status] - if User.current.admin? - @trainings = Training.includes(:training_payinfo) - if params[:search] && params[:search].strip != "" - @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 + @trainings = Training.includes(:training_payinfo) + if params[:search] && params[:search].strip != "" + @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 + respond_to do |format| format.js format.html