创建课程处添加了学校

数据库中存储学校的ID

但是学校与省份的级联还没有做好=A=
This commit is contained in:
Wen 2014-03-21 18:02:55 +08:00
parent 30eb2d79f2
commit 31b7ab8ae5
8 changed files with 42 additions and 0 deletions

View File

@ -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.

View File

@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/

View File

@ -383,6 +383,7 @@ class ProjectsController < ApplicationController
# added by bai # added by bai
@course.term = params[:term] @course.term = params[:term]
@course.time = params[:time] @course.time = params[:time]
@course.school_id = params[:school]
@course.setup_time = params[:setup_time] @course.setup_time = params[:setup_time]
@course.endup_time = params[:endup_time] @course.endup_time = params[:endup_time]
@course.class_period = params[:class_period] @course.class_period = params[:class_period]

View File

@ -0,0 +1,2 @@
class SchoolController < ApplicationController
end

View File

@ -0,0 +1,2 @@
module SchoolHelper
end

View File

@ -1,3 +1,6 @@
<% object = [] %> <% object = [] %>
<% object << 'project' %> <% object << 'project' %>
<% object << 'course' %> <% object << 'course' %>
@ -261,6 +264,23 @@
<% end %></td></tr></table></p> <% end %></td></tr></table></p>
<!-- end --> <!-- end -->
<!--added by Wen -->
<p>
<select name='province' "><%= options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province) %></select>
<%= select_tag 'school', options_from_collection_for_select(School.all, :id, :name)%>
</p>
<!-- end -->
<!-- added by huang --> <!-- added by huang -->
<!-- <p style="margin-left:-10px;"><%= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> --> <!-- <p style="margin-left:-10px;"><%= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
<p style="margin-left:-10px;"><label for="project[course]_password" style="font-size: 13px;" ><%=l(:label_new_course_password)%><span class="required"> *</span></label><input id="project_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%=@project.course_extra.password if @project.course_extra %>" size="60" name="project[course][password]"></p> <p style="margin-left:-10px;"><label for="project[course]_password" style="font-size: 13px;" ><%=l(:label_new_course_password)%><span class="required"> *</span></label><input id="project_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%=@project.course_extra.password if @project.course_extra %>" size="60" name="project[course][password]"></p>

View File

@ -0,0 +1,7 @@
require 'test_helper'
class SchoolControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class SchoolHelperTest < ActionView::TestCase
end