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

@ -87,83 +87,72 @@
<div id="put-project-form" style="display: none; padding-left: 83px; width: 88%"> <div id="put-project-form" style="display: none; padding-left: 83px; width: 88%">
<%= form_for Softapplication.new, :url => softapplications_path do |f| %> <%= form_for Softapplication.new, :url => softapplications_path do |f| %>
<fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" > <fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" >
<%= hidden_field_tag 'contest_id', @contest.id %> <%= hidden_field_tag 'contest_id', @contest.id %>
<tr style="width:700px; margin-left: -10px;"> <tr style="width:700px; margin-left: -10px;">
<span><%= l(:label_work_name) %></span> <span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td> <td><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span> <span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr> </tr>
<br/> <br/>
<br/> <br/>
<br/> <br/>
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_running_platform) %></span> <span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td> <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td>
</tr> </tr>
<br/> <br/>
<br/>
<br/>
<tr style="width:800px;"> <br/>
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>: <tr style="width:800px;">
<td style="width: 100px"><%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %></td> <span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
</tr> <tr style="width:800px;">
<br/> <span><%= l(:label_softapplication_developers) %></span>
<br/> <span class="contest-star"> * </span>:
<br/> <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td>
<tr style="width:800px;"> </tr>
<span><%= l(:label_work_description) %></span> <br/>
<span class="contest-star"> * </span>: <br/>
<td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td> <br/>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span> <span><%= l(:label_work_deposit_project) %></span>
<span class="contest-star"> * </span>: <span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2' %></span>
<td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td> <span><%= link_to l(:label_create_new_projects), new_project_path(course: 0, project_type: 0), :target => '_blank' %></span>
</tr>
<br/>
<br/>
<br/>
</tr> <fieldset style="width: 500px; padding-top: 10px">
<br/> <legend>
<br/> <%= l(:label_upload_softworkpacket_photo) %>
<br/> </legend>
<%#= render_flash_messages %>
<p id="put-bid-form-partial">
<%= render :partial => 'attachments/form' %>
</p>
<tr style="width:800px;"> <p style="font-size: 11px">
<span><%= l(:label_work_deposit_project) %></span> 1、<%= l(:label_upload_softapplication_packets_mustpacketed) %> <br/>
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2' %></span> <br>
<span><%= link_to l(:label_create_new_projects), new_project_path(course: 0, project_type: 0), :target => '_blank' %></span> 2、<%= l(:label_upload_softapplication_photo_condition) %>
</tr> </p>
<br/>
<br/>
<br/>
<fieldset style="width: 500px; padding-top: 10px"> </fieldset>
<legend>
<%= l(:label_upload_softworkpacket_photo) %>
</legend>
<%#= render_flash_messages %>
<p id="put-bid-form-partial">
<%= render :partial => 'attachments/form' %>
</p>
<p style="font-size: 11px">
1、<%= l(:label_upload_softapplication_packets_mustpacketed) %> <br/>
<br>
2、<%= l(:label_upload_softapplication_photo_condition) %>
</p>
</fieldset>
</fieldset></br> </fieldset></br>
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px"> <div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
<%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create) %>
@ -261,9 +250,9 @@
<span style="padding-left: 240px"><strong><%= l(:label_attendingcontest_spoksman) %> <span style="padding-left: 240px"><strong><%= l(:label_attendingcontest_spoksman) %>
<!-- modified by zjc 添加超链接 --> <!-- modified by zjc 添加超链接 -->
<% unless c_project.nil? || c_project.user.nil? %> <% unless c_project.nil? || c_project.user.nil? %>
</strong><%= link_to c_project.user.name,user_path(c_project.user) %></span> </strong><%= link_to c_project.user.name,user_path(c_project.user) %></span>
<% end %> <% end %>
</div> </div>
<div style="padding-left: 68px"> <div style="padding-left: 68px">
@ -298,9 +287,9 @@
<span style="padding-left: 240px"><strong><%= l(:label_attendingcontest_spoksman) %> <span style="padding-left: 240px"><strong><%= l(:label_attendingcontest_spoksman) %>
<!-- modified by zjc 添加超链接 --> <!-- modified by zjc 添加超链接 -->
<% unless c_softapplication.nil? || c_softapplication.softapplication.nil? || c_softapplication.softapplication.user.nil? %> <% unless c_softapplication.nil? || c_softapplication.softapplication.nil? || c_softapplication.softapplication.user.nil? %>
</strong><%= link_to c_softapplication.softapplication.user.name,user_path(c_softapplication.softapplication.user) %></span> </strong><%= link_to c_softapplication.softapplication.user.name,user_path(c_softapplication.softapplication.user) %></span>
<% end %> <% end %>
</div> </div>
<!--获奖及教师评奖--> <!--获奖及教师评奖-->
<div style="padding-left: 18px; padding-bottom: 5px"> <div style="padding-left: 18px; padding-bottom: 5px">

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