diff --git a/app/models/course.rb b/app/models/course.rb index 248f80e0b..dc31485f8 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -108,6 +108,11 @@ class Course < ActiveRecord::Base #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description end + # 课程的短名称信息 + def short_name(length = 8) + name.gsub(/<\/?.*?>/,"").html_safe if name + end + def strip_html(html) return html if html.empty? || !html.include?('<') output = "" diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 9b03fd776..bd21c4fff 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -45,7 +45,7 @@
@@ -54,7 +54,7 @@