This commit is contained in:
sw 2014-07-18 16:53:35 +08:00
commit 6a42ce143b
6 changed files with 69 additions and 85 deletions

View File

@ -564,10 +564,8 @@ 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,10 +76,9 @@ 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
description
end end
private private

View File

@ -84,10 +84,10 @@ class OpenSourceProject < ActiveRecord::Base
# end # end
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 # description
end end
def applied_by?(user) def applied_by?(user)

View File

@ -630,9 +630,7 @@ 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

@ -105,18 +105,7 @@
</tr> </tr>
<br/> <br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr>
<br/>
<br/>
<br/> <br/>
<tr style="width:800px;"> <tr style="width:800px;">

View File

@ -7,8 +7,8 @@ class CourseTest < ActiveSupport::TestCase
end end
test 'name valid with CJK coding' do test 'name valid with CJK coding' do
course = Course.find_by_id(74)
name_quirk = '电路与电子学基础(软件工程专业)' name_quirk = '电路与电子学基础(软件工程专业)'
course = Course.find_by_id(74)
course.name = "test_course" course.name = "test_course"
assert course.valid? assert course.valid?
course.name = name_quirk course.name = name_quirk
@ -17,9 +17,9 @@ class CourseTest < ActiveSupport::TestCase
test 'description too long must be valid.' do test 'description too long must be valid.' do
course = Course.find_by_id(8) course = Course.find_by_id(8)
course.description = course.description * 100 course.description = 'a' * 2048 # description length validate.
course.valid? course.valid?
assert_equal course.errors.full_messages.count, 0 assert course.errors[:name].empty?
assert course.valid? assert course.valid?
end end