From 31b7ab8ae589fc3a02533004a3f0008f4041d119 Mon Sep 17 00:00:00 2001 From: Wen Date: Fri, 21 Mar 2014 18:02:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AF=BE=E7=A8=8B=E5=A4=84?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=AD=A6=E6=A0=A1=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E4=B8=AD=E5=AD=98=E5=82=A8=E5=AD=A6=E6=A0=A1?= =?UTF-8?q?=E7=9A=84ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 但是学校与省份的级联还没有做好=A= --- app/assets/javascripts/school.js | 2 ++ app/assets/stylesheets/school.css | 4 ++++ app/controllers/projects_controller.rb | 1 + app/controllers/school_controller.rb | 2 ++ app/helpers/school_helper.rb | 2 ++ app/views/projects/_course_form.html.erb | 20 ++++++++++++++++++++ test/functional/school_controller_test.rb | 7 +++++++ test/unit/helpers/school_helper_test.rb | 4 ++++ 8 files changed, 42 insertions(+) create mode 100644 app/assets/javascripts/school.js create mode 100644 app/assets/stylesheets/school.css create mode 100644 app/controllers/school_controller.rb create mode 100644 app/helpers/school_helper.rb create mode 100644 test/functional/school_controller_test.rb create mode 100644 test/unit/helpers/school_helper_test.rb diff --git a/app/assets/javascripts/school.js b/app/assets/javascripts/school.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/school.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/school.css b/app/assets/stylesheets/school.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/app/assets/stylesheets/school.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0c98b804e..bc000ffaa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -383,6 +383,7 @@ class ProjectsController < ApplicationController # added by bai @course.term = params[:term] @course.time = params[:time] + @course.school_id = params[:school] @course.setup_time = params[:setup_time] @course.endup_time = params[:endup_time] @course.class_period = params[:class_period] diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb new file mode 100644 index 000000000..05a65771b --- /dev/null +++ b/app/controllers/school_controller.rb @@ -0,0 +1,2 @@ +class SchoolController < ApplicationController +end diff --git a/app/helpers/school_helper.rb b/app/helpers/school_helper.rb new file mode 100644 index 000000000..0528cb7ac --- /dev/null +++ b/app/helpers/school_helper.rb @@ -0,0 +1,2 @@ +module SchoolHelper +end diff --git a/app/views/projects/_course_form.html.erb b/app/views/projects/_course_form.html.erb index ccf4d5c30..ff45f2375 100644 --- a/app/views/projects/_course_form.html.erb +++ b/app/views/projects/_course_form.html.erb @@ -1,3 +1,6 @@ + + + <% object = [] %> <% object << 'project' %> <% object << 'course' %> @@ -261,6 +264,23 @@ <% end %>

+ + + + + + +

+ + <%= select_tag 'school', options_from_collection_for_select(School.all, :id, :name)%> +

+ + + + + + +

diff --git a/test/functional/school_controller_test.rb b/test/functional/school_controller_test.rb new file mode 100644 index 000000000..43e69fe92 --- /dev/null +++ b/test/functional/school_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SchoolControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/school_helper_test.rb b/test/unit/helpers/school_helper_test.rb new file mode 100644 index 000000000..d571ccae9 --- /dev/null +++ b/test/unit/helpers/school_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SchoolHelperTest < ActionView::TestCase +end