From 2262997c31ff34dc0d1543ba20ce0f86f1e7a9d8 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 8 Jan 2015 16:16:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E8=AF=BE=E7=A8=8B=E6=97=B6=EF=BC=9A=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=90=8D=E4=B8=AD=E6=9C=89=E7=A9=BA=E6=A0=BC=E6=88=96=E8=80=85?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E7=AC=A6=E5=8F=B7=E4=BC=9A=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=97=A0=E6=95=88,=E3=80=8B=20=20=20=20=20?= =?UTF-8?q?=20=E3=80=8A=20=E7=BC=BA=E9=99=B7=20Trustie-Forge#1782=20(?= =?UTF-8?q?=E5=B7=B2=E8=A7=A3=E5=86=B3):=20lable=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=92=8C=E5=AF=B9=E5=BA=94=E7=9A=84=E6=98=BE=E7=A4=BA=E5=80=BC?= =?UTF-8?q?=E4=B9=8B=E9=97=B4=E9=97=B4=E8=B7=9D=E8=BF=87=E5=A4=A7=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BE=8B=E5=A6=82=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=B7=A6=E4=BE=A7=E7=9A=84=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E5=85=B7=E4=BD=93=E5=A6=82=E5=9B=BE=E6=89=80=E7=A4=BA?= =?UTF-8?q?=E3=80=8B=20=20=20=20=20=E3=80=8A=E6=9C=AC=E5=9C=B0=E7=89=88?= =?UTF-8?q?=E4=B8=AD=E5=85=B3=E4=BA=8E=E5=AD=A6=E7=94=9F=E5=88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8=8D=E7=BB=9F=E4=B8=80=E3=80=82=E3=80=8B?= =?UTF-8?q?=20=20=20=20=E3=80=8A=E8=BF=9B=E5=85=A5=E6=9F=90=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E4=B8=BB=E9=A1=B5=EF=BC=8C=E7=82=B9=E5=87=BB=E5=88=9B?= =?UTF-8?q?=E6=96=B0=E7=AB=9E=E8=B5=9B=E9=93=BE=E6=8E=A5=E6=B2=A1=E5=8F=8D?= =?UTF-8?q?=E5=BA=94=E3=80=8Bbug=20Signed-off-by:=20alan=20<547533434@qq.c?= =?UTF-8?q?om>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 +- app/helpers/courses_helper.rb | 2 +- app/models/course.rb | 2 +- app/views/courses/member.html.erb | 31 +++++++++---------- app/views/layouts/base_contest.html.erb | 7 +++-- app/views/layouts/base_courses.html.erb | 10 ++++-- app/views/layouts/base_newcontest.html.erb | 10 +++--- app/views/layouts/base_projects.html.erb | 4 +-- app/views/layouts/base_users.html.erb | 36 +++++++++++----------- public/stylesheets/application.css | 2 +- 10 files changed, 57 insertions(+), 50 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 87ab7e683..e76fa31dc 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -500,7 +500,8 @@ class CoursesController < ApplicationController end end - def course + def + course @school_id = params[:school_id] per_page_option = 10 if @school_id == "0" or @school_id.nil? diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 096ce7ad8..8547ef18f 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -114,7 +114,7 @@ module CoursesHelper # 学生人数计算 # add by nwb def studentCount course - searchStudent(course).count.to_s#course.student.count + course.student.count.to_s#course.student.count end #课程成员数计算 diff --git a/app/models/course.rb b/app/models/course.rb index 196e7168d..c11f66d49 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -38,7 +38,7 @@ class Course < ActiveRecord::Base validates_presence_of :password, :term,:name validates_format_of :class_period, :with =>/^[1-9]\d*$/ - validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/ + validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ validates_length_of :description, :maximum => 10000 before_save :self_validate after_create :create_board_sync diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index d199097be..81c469fd8 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,21 +1,19 @@ -
- <%= l(:label_user_joinin) %>: + | + <%= l(:label_user_joinin) %>: | <%= format_time(@user.created_on) %> | ||
- <%= l(:label_user_login) %>: + | + <%= l(:label_user_login) %>: | <%= format_time(@user.last_login_on) %> @@ -239,8 +239,8 @@ <% unless @user.user_extensions.nil? %> <% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %> | ||
- <%= l(:field_occupation) %>: + | + <%= l(:field_occupation) %>: | <% unless @user.user_extensions.school.nil? %> @@ -250,8 +250,8 @@ | ||
- <%= l(:field_occupation) %>: + | + <%= l(:field_occupation) %>: | <%= @user.user_extensions.occupation %> @@ -259,8 +259,8 @@ | ||
- <%= l(:label_company_name) %>: + | + <%= l(:label_company_name) %>: | <%= @user.firstname %> @@ -268,8 +268,8 @@ | ||
- <%= l(:label_location) %>: + | + <%= l(:label_location) %>: | <%= @user.user_extensions.location %> @@ -278,8 +278,8 @@ | ||
- <%= l(:label_technical_title) %>: + | + <%= l(:label_technical_title) %>: | @@ -289,8 +289,8 @@ <% if @user.user_extensions.identity == 1 %> <% if(is_watching?(@user) ) %> | ||
- <%= l(:label_bidding_user_studentcode)%>: + | + <%= l(:label_bidding_user_studentcode)%>: | <%= @user.user_extensions.student_id %> @@ -298,7 +298,7 @@ | ||
+ | <%= l(:label_identity)%>: | @@ -309,7 +309,7 @@ <% end %> <% elsif @user.user_extensions.identity == 3 %> | ||
+ | <%= l(:label_identity)%>: | diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 282b760b2..54e2a17aa 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2912,7 +2912,7 @@ input[class~='ButtonClolr'],.ButtonColor{ input[class~='m3p10'], .m3p10 { margin-top: 5px; - padding: 5px 10px !important; + padding: 5px 10px; height: 20px; display: inline-block; color: #ffffff; From 9bbc8d64eb67c64480c5dc8b8c1a9654605d8106 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Thu, 8 Jan 2015 17:04:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=AF=8D=E7=89=88?= =?UTF-8?q?=E9=A1=B5=E5=8A=A0=E8=BD=BD=E7=BC=93=E6=85=A2=20Signed-off-by:?= =?UTF-8?q?=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 2 +- app/views/layouts/base_courses.html.erb | 14 ++++++++------ app/views/layouts/base_newcontest.html.erb | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 8547ef18f..a862753ef 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -20,7 +20,7 @@ module CoursesHelper # 返回教师数量,即roles表中定义的Manager def teacherCount project - searchTeacherAndAssistant(project).count + project.members.count - studentCount(project).to_i # or # searchTeacherAndAssistant(project).count end diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 3c174ce84..a79914f61 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -2,6 +2,8 @@ @nav_dispaly_forum_label = 1 @nav_dispaly_course_label = nil @nav_dispaly_store_all_label = 1 %> +<% teacher_num = teacherCount(@course) %> +<% student_num = studentCount(@course) %> @@ -124,19 +126,19 @@ | <% if User.current.member_of_course?(@course) %> - <%= link_to "#{teacherCount(@course)}", course_member_path(@course, :role => 1), :course => '1' %> + <%= link_to "#{teacher_num}", course_member_path(@course, :role => 1), :course => '1' %> <% else %> - <%= teacherCount(@course)%> + <%= teacher_num %> <% end%> | <% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) %> - <%= link_to "#{studentCount(@course)}", course_member_path(@course, :role => 2), :course => '1' %> + <%= link_to "#{student_num}", course_member_path(@course, :role => 2), :course => '1' %> <% else %> - <%= studentCount(@course)%> + <%= student_num %> <% end %> | @@ -145,10 +147,10 @@
- <%= l(:label_x_base_courses_teacher, :count => teacherCount(@course)) %> + <%= l(:label_x_base_courses_teacher, :count => teacher_num) %> | - <%= l(:label_x_base_courses_student, :count => studentCount(@course)) %> + <%= l(:label_x_base_courses_student, :count => student_num) %> | <%= l(:label_x_course_data, :count => files_count) %> diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 816f9ce58..6c3721fcf 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -78,8 +78,8 @@ | ||
<%=link_to l(:field_homepage), home_path %> >
-
- <%=link_to l(:label_contest_innovate), home_path %>
+
+ <%=l(:label_courses_management_platform)%>
>
<%= link_to h(truncate(@contest.name, length: 20, omission: '...')), show_contest_contest_path(@contest) %>
From aae69417cd2271598ffef45ccc9ed6b8f0982723 Mon Sep 17 00:00:00 2001
From: zhuhao |