From 756d703b5a6d67c73ea6634523331a552df26d0a Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 1 Sep 2015 15:34:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=A1=86=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=96=87=E5=AD=97=E7=B1=BB=E4=BC=BC=E4=BA=8E?= =?UTF-8?q?=E2=80=9C=E8=AF=B7=E9=80=89=E6=8B=A9=E5=8F=91=E5=B8=83=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E7=9A=84=E8=AF=BE=E7=A8=8B=E2=80=9D=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=8D=B3=E5=BC=B9=E5=87=BA=E4=BE=9B=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=9A=84=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=EF=BC=8C=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=90=8D=E7=A7=B0=E5=90=8E=E8=BF=98=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BC=80=E8=AF=BE=E5=AD=A6=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 15 ++++++++++++++- app/views/users/_user_homework_form.html.erb | 7 ++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index e7ab001da..d9458bdaa 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -541,7 +541,7 @@ module UsersHelper end end - #获取指定用户作为老师的课程 +=begin def get_as_teacher_courses user type = [] user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| @@ -552,5 +552,18 @@ module UsersHelper end type end +=end + + #获取指定用户作为老师的课程 + def get_as_teacher_courses_terms user + type = [] + user.courses.select{|c| user.allowed_to?(:as_teacher,c)}.each do |course| + option = [] + option << course.name+"("+course.time.to_s+course.term+")" + option << course.id + type << option + end + type + end end diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 7cd4da414..9ff31a9d2 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -27,7 +27,7 @@
- <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w708",:value => "请选择发布作业的课程"} %> + <%= select_tag :course_id, options_for_select(get_as_teacher_courses_terms(User.current), homework.course_id), {:class => "InputBox w708"} %>
@@ -43,3 +43,8 @@
+ \ No newline at end of file