You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/weapps/homes_controller.rb

20 lines
636 B

5 years ago
class Weapps::HomesController < Weapps::BaseController
5 years ago
before_action :require_wechat_login!
5 years ago
def show
# banner
@carousels = WeappSettings::Carousel.only_online
# 广告
@advert = WeappSettings::Advert.only_online.first
5 years ago
5 years ago
# 我的课堂
category = params[:category] && ["manage", "study"].include?(params[:category]) ? params[:category] : (current_user.is_teacher? ? "manage" : "study")
@courses = case category
when 'study' then
current_user.as_student_courses.started
when 'manage' then
current_user.manage_courses
end
5 years ago
end
end