This commit is contained in:
z9hang 2014-07-18 10:49:38 +08:00
commit 057447f810
11 changed files with 1241 additions and 1222 deletions

View File

@ -474,11 +474,16 @@ module ApplicationHelper
def principals_check_box_tags_ex(name, principals)
s = ''
principals.each do |principal|
if principal.has_attribute?(:userInfo)
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
else
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal}</label>\n"
end
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
end
s.html_safe
end
#扩展的checkbox生成
def principals_radio_box_tags_ex(name, principals)
s = ''
principals.each do |principal|
s << "<label>#{ radio_button_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
end
s.html_safe
end

View File

@ -104,10 +104,17 @@ module CoursesHelper
garble count
end
alias studentCountOrigin studentCount
# 注意:此方法有问题,速度慢且结果不准
# alias studentCountOrigin studentCount
#def studentCount course
# count = studentCountOrigin course
#garble count
# end
# 学生人数计算
# add by nwb
def studentCount course
count = studentCountOrigin course
garble count
course.student.count
end
def eventToLanguageCourse event_type, course

View File

@ -21,7 +21,7 @@ class Course < ActiveRecord::Base
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :homework_for_courses, :dependent => :destroy
has_many :student, :through => :students_for_courses, :source => :user
has_many :student, :class_name => 'StudentsForCourse', :source => :user
has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy
has_many :enabled_modules, :dependent => :delete_all
has_many :boards, :dependent => :destroy, :order => "position ASC"
@ -39,7 +39,7 @@ class Course < ActiveRecord::Base
validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/
before_save :self_validate
after_save :create_board_sync
after_create :create_board_sync
before_destroy :delete_all_members
safe_attributes 'extra',

View File

@ -564,8 +564,10 @@ class Issue < ActiveRecord::Base
end
# 缺陷的短描述信息
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
end
private :workflow_rule_by_attribute

View File

@ -76,8 +76,10 @@ class News < ActiveRecord::Base
# 新闻的短描述信息
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
end
private

View File

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

View File

@ -127,7 +127,7 @@ class Project < ActiveRecord::Base
after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board之后的board去掉了board的概念
after_save :create_board_sync
after_create :create_board_sync
before_destroy :delete_all_members
def remove_references_before_destroy
return if self.id.nil?
@ -630,7 +630,9 @@ class Project < ActiveRecord::Base
# Returns a short description of the projects (first lines)
def short_description(length = 255)
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
description.gsub(/<\/?.*?>/,"").html_safe if description
# 不再使用短描述
# description.gsub(/<\/?.*?>/,"").html_safe if description
description
end
def css_classes

View File

@ -32,7 +32,7 @@
<p>
<% roles.each do |role| %>
<label><%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
<label><%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> <%= h role %></label><br/>
<% end %></p>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
@ -82,7 +82,7 @@
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
<% roles.each do |role| %>
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
<label><%= radio_button_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
<% end %></p>
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>

View File

@ -150,7 +150,7 @@
<div class="d-p-projectlist">
<% 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">
<%= image_tag('/images/contest1.png')%>
</div>
@ -165,8 +165,8 @@
<% end %>
</div>
<div class='text_nowrap' 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>
<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.to_s%></span>
</div><br />
<div style="padding-left: 57px; clear: left;">

View File

@ -63,7 +63,7 @@
<% #projects = find_miracle_project(10, 3) %>
<% @projects.map do |project| %>
<!--<%# 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;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
</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 "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
</div>
<div class='text_nowrap' 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>
<div style=" float: left;margin:5px; margin-left: 10px; width: 380px;">
<span class='font_lighter' title =<%=project.description.to_s%>><%=project.description%></span>
</div>
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;">
<div >
<%# issue_count = project.issues.count %>
<%# issue_journal_count = project.issue_changes.count %>
<%# 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 %>
<%= 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 => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip",
:id => "tooltip-#{project.id}" %>

File diff suppressed because it is too large Load Diff