diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 27a973213..ac142f5a1 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -682,28 +682,30 @@ module CoursesHelper # activity = CourseActivity.first title = "" url = "" - case activity.course_act_type - when "Course" - title = activity.course_act.name - url = course_path activity.course - when "HomeworkCommon" - title = "作业 " + activity.course_act.name - url = student_work_index_path(:homework => activity.course_act.id) - when "News" - title = "通知公告 " + activity.course_act.title - url = course_news_index_path(activity.course) - when "Attachment" - title = "课件 " + activity.course_act.filename - url = course_files_path(activity.course) - when "Message" - title = "课程讨论区 " + activity.course_act.subject - url = course_boards_path(activity.course,:parent_id => activity.course_act.parent_id ? activity.course_act.parent_id : activity.course_act.id, :topic_id => activity.course_act.id) - when "JournalsForMessage" - title = "留言 " + activity.course_act.notes - url = course_feedback_path(activity.course) - when "Poll" - title = "问卷 " + activity.course_act.polls_name - url = poll_index_path(:polls_type => "Course", :polls_group_id => activity.course_id) + if activity.course_act + case activity.course_act_type + when "Course" + title = activity.course_act.name + url = course_path activity.course + when "HomeworkCommon" + title = "作业 " + activity.course_act.name + url = student_work_index_path(:homework => activity.course_act.id) + when "News" + title = "通知公告 " + activity.course_act.title + url = course_news_index_path(activity.course) + when "Attachment" + title = "课件 " + activity.course_act.filename + url = course_files_path(activity.course) + when "Message" + title = "课程讨论区 " + activity.course_act.subject + url = course_boards_path(activity.course,:parent_id => activity.course_act.parent_id ? activity.course_act.parent_id : activity.course_act.id, :topic_id => activity.course_act.id) + when "JournalsForMessage" + title = "留言 " + activity.course_act.notes + url = course_feedback_path(activity.course) + when "Poll" + title = "问卷 " + activity.course_act.polls_name + url = poll_index_path(:polls_type => "Course", :polls_group_id => activity.course_id) + end end link_to title.gsub(/<(?!img)[^>]*>/,'').html_safe, url, :class => "problem_tit c_dblue fl fb" end