课程动态,无对应数据时报错

Branch_szzh
sw 10 years ago
parent 4b5022bfc6
commit 3e9f3f4e70

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

Loading…
Cancel
Save