课程注册与用户注册页面的学校选择全部搞定!

This commit is contained in:
Wen 2014-04-15 17:37:38 +08:00
parent 37bb5341e4
commit c34f2da385
7 changed files with 107 additions and 8 deletions

View File

@ -390,7 +390,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.school_name = params[:occupation]
@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

@ -91,7 +91,7 @@
<p style="width:357px;padding-left: 26px;"> <p style="width:357px;padding-left: 26px;">
<%= l(:field_occupation) %>&nbsp;<%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), :onchange => "get_options(this.value)" %> <%= l(:field_occupation) %>&nbsp;<%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), :onchange => "get_options(this.value)" %>
<%= select_tag "occupation" %> <%= select_tag "occupation", options_for_select([['安徽大学','安徽大学'],['合肥工业大学','合肥工业大学'],['中国科技大学','中国科技大学']]) %>
</p> </p>

View File

@ -1,4 +1,19 @@
<script type="text/javascript">
function get_options(value){
$.ajax({
type :"POST",
url :'/school/get_options/'+encodeURIComponent(value),
data :'text',
success: function(data){
$("#occupation").html(data);
}
}
)
}
</script>
<% object = [] %> <% object = [] %>
@ -269,10 +284,12 @@
<!--added by Wen --> <!--added by Wen -->
<p style="margin-left:-76px;">
<strong><%=l(:label_new_course_school)%></strong><span class="required">*</span>&nbsp;&nbsp;&nbsp;
<%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), :onclick => "get_options(this.value)" %>
<p> <%= select_tag "occupation", options_for_select([['安徽大学','安徽大学'],['合肥工业大学','合肥工业大学'],['中国科技大学','中国科技大学']]) %>
<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> </p>
<!-- end --> <!-- end -->

View File

@ -1746,6 +1746,7 @@ zh:
label_exit_course: 退出课程 label_exit_course: 退出课程
label_new_join: 加入 label_new_join: 加入
label_new_course_password: 课程密码 label_new_course_password: 课程密码
label_new_course_school: 开课学校
label_new_course_description: 课程描述 label_new_course_description: 课程描述
label_new_join_order: 请输入课程密码 label_new_join_order: 请输入课程密码
label_task_submit_form_accessory: 作业最终以附件形式提交 label_task_submit_form_accessory: 作业最终以附件形式提交

View File

@ -0,0 +1,11 @@
class RemoveSchoolidFromCourses < ActiveRecord::Migration
def up
remove_column :courses, :school_id
end
def down
add_column :courses, :school_id, :integer
end
end

View File

@ -0,0 +1,6 @@
class AddSchoolNameToCourses < ActiveRecord::Migration
def change
add_column :courses, :school_name, :string
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140320022724) do ActiveRecord::Schema.define(:version => 20140415090829) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -157,6 +157,38 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
add_index "comments", ["author_id"], :name => "index_comments_on_author_id" add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
create_table "contesting_projects", :force => true do |t|
t.integer "project_id"
t.string "contest_id"
t.integer "user_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "contesting_softapplications", :force => true do |t|
t.integer "softapplication_id"
t.integer "contest_id"
t.integer "user_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "contests", :force => true do |t|
t.string "name"
t.integer "budget"
t.integer "author_id"
t.date "deadline"
t.string "description"
t.integer "commit"
t.string "password"
t.datetime "created_on", :null => false
t.datetime "updated_on", :null => false
end
create_table "courses", :force => true do |t| create_table "courses", :force => true do |t|
t.integer "tea_id" t.integer "tea_id"
t.string "name" t.string "name"
@ -173,7 +205,7 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
t.string "setup_time" t.string "setup_time"
t.string "endup_time" t.string "endup_time"
t.string "class_period" t.string "class_period"
t.integer "school_id" t.string "school_name"
end end
create_table "custom_fields", :force => true do |t| create_table "custom_fields", :force => true do |t|
@ -354,6 +386,13 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
add_index "issues", ["status_id"], :name => "index_issues_on_status_id" add_index "issues", ["status_id"], :name => "index_issues_on_status_id"
add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id" add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id"
create_table "join_in_competitions", :force => true do |t|
t.integer "user_id"
t.integer "competition_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "join_in_contests", :force => true do |t| create_table "join_in_contests", :force => true do |t|
t.integer "user_id" t.integer "user_id"
t.integer "bid_id" t.integer "bid_id"
@ -645,6 +684,21 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
t.string "description" t.string "description"
end end
create_table "softapplications", :force => true do |t|
t.string "name"
t.string "description"
t.integer "app_type_id"
t.string "app_type_name"
t.string "android_min_version_available"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "contest_id"
t.integer "softapplication_id"
t.integer "is_public"
t.string "application_developers"
end
create_table "students_for_courses", :force => true do |t| create_table "students_for_courses", :force => true do |t|
t.integer "student_id" t.integer "student_id"
t.integer "course_id" t.integer "course_id"
@ -758,6 +812,16 @@ ActiveRecord::Schema.define(:version => 20140320022724) do
add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id"
create_table "user_scores", :force => true do |t|
t.integer "user_id", :null => false
t.integer "collaboration"
t.integer "influence"
t.integer "skill"
t.integer "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "user_statuses", :force => true do |t| create_table "user_statuses", :force => true do |t|
t.integer "changesets_count" t.integer "changesets_count"
t.integer "watchers_count" t.integer "watchers_count"