From 5a2d0ce649cdc0959db7360e050eda38b115f61b Mon Sep 17 00:00:00 2001 From: nwb Date: Fri, 1 Aug 2014 15:52:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?issue#1077=20=E6=96=B0=E5=BB=BA=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E7=9A=84=E5=A5=96=E9=87=91=E6=8D=A2=E8=A1=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E9=95=BF=E5=BA=A6=E7=BA=A6=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/_form_contest.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/contests/_form_contest.html.erb b/app/views/contests/_form_contest.html.erb index 5dc824d28..79c531969 100644 --- a/app/views/contests/_form_contest.html.erb +++ b/app/views/contests/_form_contest.html.erb @@ -23,12 +23,12 @@

<%= l(:label_bids_form_contest_new_description) %>

<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Contest::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %>

-

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %>

+

<%= f.text_area :description, :rows => 5, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %>

<%= f.text_field :password, :size => 60, :style => "width:488px;margin-left: 10px;" %>

- <%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %> + <%= f.text_area :budget, :required => true, :size => 60,:rows => 4,:maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :style => "width:490px;", :placeholder => l(:label_bids_reward_what) %>

From acb41158e79776f68e72580fa3eee852fc1a6bb5 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 1 Aug 2014 16:01:16 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20=E7=99=BB=E9=99=86=E6=97=B6=E8=87=AA=E5=8A=A8=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E7=99=BB=E9=99=86=E5=90=8D=E5=89=8D=E5=90=8E=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/models/user.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c4b72f584..f47ba446e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -525,7 +525,7 @@ class ApplicationController < ActionController::Base # # @return [boolean, string] name of the layout to use or false for no layout def use_layout - request.xhr? ? false : 'base' + request.xhr? ? false : 'users_base' end def invalid_authenticity_token diff --git a/app/models/user.rb b/app/models/user.rb index 195346e7c..b64d0efd7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -324,7 +324,7 @@ class User < Principal # Returns the user that matches provided login and password, or nil #登录,返回用户名与密码匹配的用户 def self.try_to_login(login, password) - login = login.to_s + login = login.to_s.lstrip.rstrip password = password.to_s # Make sure no one can sign in with an empty login or password From ff02c4f9f2bf844b093ba52201b1988211296065 Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 1 Aug 2014 17:43:06 +0800 Subject: [PATCH 3/4] =?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 4/4] =?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 %>