From 495c4db43e31e5c0b5fc2be8f911f0a00072a751 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 3 Nov 2014 17:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=9F=E8=83=BD<=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=85=AC=E5=BC=80=E5=8A=9F=E8=83=BD>=20Signed-off-by:=20alan?= =?UTF-8?q?=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 5 +++-- app/views/courses/_course_form.html.erb | 8 +++++++- app/views/layouts/base_courses.html.erb | 2 +- config/locales/zh.yml | 2 ++ config/routes.rb | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index 1f0cb0979..b2da58a81 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -5,7 +5,7 @@ class Course < ActiveRecord::Base STATUS_CLOSED = 5 STATUS_ARCHIVED = 9 - attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period + attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表 @@ -52,7 +52,8 @@ class Course < ActiveRecord::Base 'term', 'is_public', 'description', - 'class_period' + 'class_period', + 'open_student' acts_as_customizable diff --git a/app/views/courses/_course_form.html.erb b/app/views/courses/_course_form.html.erb index 4324c5d47..cd8c71132 100644 --- a/app/views/courses/_course_form.html.erb +++ b/app/views/courses/_course_form.html.erb @@ -110,7 +110,13 @@ <%= f.check_box :is_public, :style => "margin-left:10px;" %> <%= l(:label_course_public_info) %> -
+ ++ + <%= f.check_box :open_student, :style => "margin-left:10px;" %> + <%= l(:label_course_open_student_info) %> + +
<%= wikitoolbar_for 'course_description' %> <% @course.custom_field_values.each do |value| %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 04249b3bc..714f3f5f7 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -121,7 +121,7 @@ <% end%>