课程和项目的首页,在标签名称中显示

This commit is contained in:
daiao 2016-12-21 10:29:54 +08:00
parent adce17c877
commit 51f5bb6050
2 changed files with 9 additions and 1 deletions

View File

@ -2109,6 +2109,7 @@ class UsersController < ApplicationController
# 课程社区
def course_community
@course_community = "课程"
if params[:course_id] != nil
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
@ -2176,6 +2177,7 @@ class UsersController < ApplicationController
def project_community
# 看别人的主页显示动态
#更新用户申请成为课程老师或教辅消息的状态
@project_community = "项目"
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
@page = params[:page] ? params[:page].to_i + 1 : 0
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"

View File

@ -1289,7 +1289,13 @@ module ApplicationHelper
elsif @organization
title << @organization.name
elsif @user
if !@project_community.blank?
title << @project_community
elsif !@course_community.blank?
title << @course_community
else
title << @user.try(:realname)
end
elsif @syllabus
title << @syllabus.title
else