修正二级菜单名称显示问题

This commit is contained in:
nwb 2014-07-16 09:45:39 +08:00
parent 13a3725b06
commit 3254c4a237
3 changed files with 8 additions and 3 deletions

View File

@ -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 = ""

View File

@ -45,7 +45,7 @@
<ul class="course_sub_menu">
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<li><%= link_to course.name, course_path(course) %></li>
<li><%= link_to course.name.truncate(10, omission: '...'), course_path(course) %></li>
<% end %>
<% end %>
</ul>
@ -54,7 +54,7 @@
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
<ul class="project_sub_menu">
<% User.current.projects.each do |project| %>
<li><%= link_to project.name, project_path(project) %></li>
<li><%= link_to project.name.truncate(10, omission: '...'), project_path(project) %></li>
<% end %>
</ul>
</li>

View File

@ -2170,7 +2170,7 @@ ul.messages-for-user-reply li {
left: 115px;
padding-bottom: 5px;
position: absolute;
top: 40px;
top: 0px;
font-size: 1.1em;
margin: 0px auto;
padding: 0px 0px;