From ff02c4f9f2bf844b093ba52201b1988211296065 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 1 Aug 2014 17:43:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=80=81=E5=B8=88=E3=80=81=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E4=B8=8E=E8=AF=BE=E7=A8=8B=E4=B8=AD=E8=80=81?= =?UTF-8?q?=E5=B8=88=E3=80=81=E5=AD=A6=E7=94=9F=E6=95=B0=E9=87=8F=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E4=B8=BB=E9=A1=B5=E8=AF=BE=E7=A8=8B=E6=8E=A8?= =?UTF-8?q?=E8=8D=90=E4=B8=AD=E6=98=BE=E7=A4=BA=E7=9A=84=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E4=B8=8E=E8=AF=BE=E7=A8=8B=E6=80=BB=E4=BA=BA?= =?UTF-8?q?=E6=95=B0=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 25 +++++++++++++++++++------ app/views/welcome/course.html.erb | 6 +++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 84aff1c25..aad350d22 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -98,11 +98,11 @@ module CoursesHelper end - alias teacherCountOrigin teacherCount - def teacherCount project - count = teacherCountOrigin project - garble count - end + #alias teacherCountOrigin teacherCount + #def teacherCount project + # count = teacherCountOrigin project + # garble count + #end # 注意:此方法有问题,速度慢且结果不准 # alias studentCountOrigin studentCount @@ -114,7 +114,7 @@ module CoursesHelper # 学生人数计算 # add by nwb def studentCount course - count = course.student.count + count = searchStudent(course).count#course.student.count if count <= 5 result = count.to_s elsif count < 10 && count > 5 @@ -125,6 +125,19 @@ module CoursesHelper result end + #课程成员数计算 + def memberCount course + count = searchStudent(course).count + searchTeacherAndAssistant(course).count + if count <= 5 + result = count.to_s + elsif count < 10 && count > 5 + result = "5+" + else + result = (count-count % 10).to_s + "+" + end + result + end + def eventToLanguageCourse event_type, course case event_type when "issue-note" diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 3aca2c350..46a6d03a1 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -123,7 +123,7 @@
[<%= get_course_term course %>] <%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> - (<%= "#{studentCount(course)}人" %>) + (<%= "#{memberCount(course)}人" %>) <% files_count = course.attachments.count.to_s %> (<%= link_to "#{files_count}份", course_files_path(course) %>资料)
@@ -164,7 +164,7 @@
[<%= get_course_term course %>] <%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> - (<%= "#{studentCount(course)}人" %>) + (<%= "#{memberCount(course)}人" %>) <% files_count = course.attachments.count.to_s %> (<%= link_to "#{files_count}份", course_files_path(course) %>资料)
@@ -209,7 +209,7 @@
[<%= get_course_term course %>] <%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %> - (<%= "#{studentCount(course)}人" %> ) + (<%= "#{memberCount(course)}人" %> ) <% files_count = course.attachments.count.to_i.to_s %> (<%= link_to "#{files_count}份", course_files_path(course) %>资料)
From 5a5ac28833a2ec72c6b9c8f5183e6677886d3714 Mon Sep 17 00:00:00 2001 From: zhanghaitao Date: Sat, 2 Aug 2014 15:16:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/users.html.erb | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/app/views/admin/users.html.erb b/app/views/admin/users.html.erb index 41df178d8..834c9f6c2 100644 --- a/app/views/admin/users.html.erb +++ b/app/views/admin/users.html.erb @@ -26,9 +26,9 @@  
- +
- + <%= sort_header_tag('login', :caption => l(:field_login)) %> <%= sort_header_tag('firstname', :caption => l(:field_firstname)) %> <%= sort_header_tag('lastname', :caption => l(:field_lastname)) %> @@ -40,16 +40,25 @@ + + + + + + + + + <% for user in @users -%> "> - - - - - - - + + + + + + +
<%= avatar(user, :size => "14") %><%= link_to h(user.login), edit_user_path(user) %><%= h(user.firstname) %><%= h(user.lastname) %><%= checked_image user.admin? %><%= format_time(user.created_on) %> <%= avatar(user, :size => "14") %><%= link_to h(user.login), edit_user_path(user) %><%= h(user.firstname) %><%= h(user.lastname) %><%= checked_image user.admin? %><%= format_time(user.created_on) %> <%= change_status_link(user) %> <%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %>