1.项目首页的描述更改,不再限制项目描述字数

2.竞赛首页的描述更改,不再限制竞赛描述字数
This commit is contained in:
nwb 2014-07-18 09:21:09 +08:00
parent ed00adb3ba
commit 8eac756ac7
6 changed files with 20 additions and 12 deletions

View File

@ -564,8 +564,10 @@ class Issue < ActiveRecord::Base
end end
# 缺陷的短描述信息 # 缺陷的短描述信息
def short_description(length = 255) def short_description(length = 255)
description.gsub(/<\/?.*?>/,"").html_safe if description # 不再使用短描述
#description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
description
end end
private :workflow_rule_by_attribute private :workflow_rule_by_attribute

View File

@ -76,8 +76,10 @@ class News < ActiveRecord::Base
# 新闻的短描述信息 # 新闻的短描述信息
def short_description(length = 255) def short_description(length = 255)
description.gsub(/<\/?.*?>/,"").html_safe if description #description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
# 不再使用短描述
description
end end
private private

View File

@ -85,7 +85,9 @@ class OpenSourceProject < ActiveRecord::Base
def short_description(length = 255) def short_description(length = 255)
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
description.gsub(/<\/?.*?>/,"").html_safe if description #description.gsub(/<\/?.*?>/,"").html_safe if description
# 不再使用短描述
description
end end
def applied_by?(user) def applied_by?(user)

View File

@ -630,7 +630,9 @@ class Project < ActiveRecord::Base
# Returns a short description of the projects (first lines) # Returns a short description of the projects (first lines)
def short_description(length = 255) def short_description(length = 255)
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
description.gsub(/<\/?.*?>/,"").html_safe if description # 不再使用短描述
# description.gsub(/<\/?.*?>/,"").html_safe if description
description
end end
def css_classes def css_classes

View File

@ -150,7 +150,7 @@
<div class="d-p-projectlist"> <div class="d-p-projectlist">
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %> <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'> <li style="overflow:auto;word-break:break-all;height:100%;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4" style="float: left; margin-top: 7px"> <div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/contest1.png')%> <%= image_tag('/images/contest1.png')%>
</div> </div>
@ -165,8 +165,8 @@
<% end %> <% end %>
</div> </div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;"> <div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;">
<span class='font_lighter' title =<%=contest.description.to_s%>><%=contest.description.truncate(50, omission: '...')%></span> <span class='font_lighter' title =<%=contest.description.to_s%>><%=contest.description.to_s%></span>
</div><br /> </div><br />
<div style="padding-left: 57px; clear: left;"> <div style="padding-left: 57px; clear: left;">

View File

@ -63,7 +63,7 @@
<% #projects = find_miracle_project(10, 3) %> <% #projects = find_miracle_project(10, 3) %>
<% @projects.map do |project| %> <% @projects.map do |project| %>
<!--<%# cache cache_key_for_project(project) do %> --> <!--<%# cache cache_key_for_project(project) do %> -->
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'> <li style="overflow:auto;word-break:break-all;height:100%;" class='<%= cycle("odd", "even") %>'>
<div style="float: left;"> <div style="float: left;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %> <%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
</div> </div>
@ -72,10 +72,10 @@
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>) (<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
</div> </div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; width: 380px;"> <div style=" float: left;margin:5px; margin-left: 10px; width: 380px;">
<span class='font_lighter' title =<%=project.short_description.to_s%>><%=project.short_description.truncate(50, omission: '...')%></span> <span class='font_lighter' title =<%=project.description.to_s%>><%=project.description%></span>
</div> </div>
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;"> <div >
<%# issue_count = project.issues.count %> <%# issue_count = project.issues.count %>
<%# issue_journal_count = project.issue_changes.count %> <%# issue_journal_count = project.issue_changes.count %>
<%# issue_score = issue_count * 0.2 %> <%# issue_score = issue_count * 0.2 %>
@ -103,7 +103,7 @@
<%# finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %> <%# finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
<%= content_tag "span", l(:label_project_score)+ ":" + project_score(project), <%= content_tag "span", l(:label_project_score)+ ":" + project_score(project),
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ", :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip", :class => "tooltip",
:id => "tooltip-#{project.id}" %> :id => "tooltip-#{project.id}" %>