Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
057447f810
|
@ -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.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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;">
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -2231,4 +2231,3 @@ ul.messages-for-user-reply li {
|
|||
.footer_text_link{
|
||||
margin: 0px 5px;
|
||||
}
|
||||
/*gcm*/
|
Loading…
Reference in New Issue