diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 5e0ef4638..fe707ac5b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -32,6 +32,13 @@ class CoursesController < ApplicationController before_filter :require_login, :only => [:join, :unjoin] #before_filter :allow_join, :only => [:join] + # 邀请码停用/启用 + def set_invite_code_halt + if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? + @course.update_attribute('invite_code_halt', @course.invite_code_halt == 0 ? 1 : 0) + end + end + #查找组织 def search_public_orgs_not_in_course condition = '%%' diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 43bdf9e09..c1c5f4f9f 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -584,6 +584,8 @@ class CoursesService @state = 2 elsif course[:is_delete] == 1 @state = 11 + elsif course[:invite_code_halt] == 1 + @state = 14 else if current_user.member_of_course?(course) #如果已经是成员 @state = 3 diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index a159886fd..ff094c1ff 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -10,7 +10,6 @@
  • -
  • @@ -18,14 +17,13 @@ 教师 助教 学生 -
  • -
  • +

    请至少选择一个身份

    +
  • - 确  定 + 确  定 取  消 -
  • @@ -33,6 +31,16 @@ \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 98c12d83b..026e65846 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1253,6 +1253,7 @@ RedmineApp::Application.routes.draw do post 'add_members' get 'delete_member' get 'archive_course' + get 'set_invite_code_halt' end collection do match 'join_private_courses', :via => [:get, :post] diff --git a/db/migrate/20161208015939_add_column_to_course.rb b/db/migrate/20161208015939_add_column_to_course.rb new file mode 100644 index 000000000..f336a90c0 --- /dev/null +++ b/db/migrate/20161208015939_add_column_to_course.rb @@ -0,0 +1,5 @@ +class AddColumnToCourse < ActiveRecord::Migration + def change + add_column :courses, :invite_code_halt, :integer, :limit => 1, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index bd3645e2c..6dd41fa00 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20161128072528) do +ActiveRecord::Schema.define(:version => 20161208015939) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -629,6 +629,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do t.string "invite_code" t.string "qrcode" t.integer "qrcode_expiretime", :default => 0 + t.integer "invite_code_halt", :limit => 1, :default => 0 end add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true @@ -820,11 +821,13 @@ ActiveRecord::Schema.define(:version => 20161128072528) do t.integer "exercise_status" t.integer "user_id" t.integer "time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.datetime "publish_time" t.datetime "end_time" t.integer "show_result" + t.integer "question_random", :default => 0 + t.integer "choice_random", :default => 0 end create_table "first_pages", :force => true do |t| @@ -864,6 +867,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do t.datetime "updated_at", :null => false t.string "secret_key" t.integer "status" + t.integer "operate_user_id" end add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" @@ -939,6 +943,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do t.integer "quotes", :default => 0 t.integer "is_open", :default => 0 t.datetime "simi_time" + t.integer "score_open", :default => 1 end add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" @@ -964,6 +969,7 @@ ActiveRecord::Schema.define(:version => 20161128072528) do t.integer "homework_common_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "no_anon_penalty", :default => 1 end create_table "homework_detail_programings", :force => true do |t| @@ -1538,6 +1544,12 @@ ActiveRecord::Schema.define(:version => 20161128072528) do t.datetime "updated_at", :null => false end + create_table "professional_levels", :force => true do |t| + t.string "level" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1628,8 +1640,11 @@ ActiveRecord::Schema.define(:version => 20161128072528) do t.integer "pull_request_id" t.integer "gpid" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "status", :default => 0 + t.integer "project_id" + t.string "title" end create_table "quality_analyses", :force => true do |t| diff --git a/public/javascripts/application.js b/public/javascripts/application.js index c3bd332a9..03b6e6c20 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1715,7 +1715,7 @@ function expand_course_list(id, target, btnid, count) { //点击删除时的确认弹框 function delete_confirm_box(url, str){ var htmlvalue = '

    提示

    '+ - '

    ' + str + '

    确定'+ + '

    ' + str + '

    确定'+ '取消
    '; pop_box_new(htmlvalue, 300, 140); } diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index 931aeb39e..4998fb966 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -174,6 +174,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .mr100 {margin-right:100px !important;} .mr118 {margin-right:118px !important;} .mr130 {margin-right:130px;} +.mr135 {margin-right:135px;} .mr150 {margin-right:150px;} .mw15{margin:0 15px;} .mr90 {margin-right:90px;} @@ -673,6 +674,21 @@ a.sy_btn_grey_mini{ border-radius:3px; } a:hover.sy_btn_grey_mini{ background: #c3c3c3;} +a.btn_grey_mid{ + display:inline-block; + color: #565656; + background: #eaeaea; + text-align: center; + font-size: 12px; + padding:0 10px; + height: 26px; + line-height: 26px; + -webkit-border-radius:3px; + -moz-border-radius:3px; + -o-border-radius:3px; + border-radius:3px; +} +a:hover.btn_grey_mid{ background: #c8c8c8;} a.sy_btn_green{ display:inline-block; color: #fff; diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 499e4a336..c38e1bd79 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -289,11 +289,10 @@ a.sy_class_option:hover { } .sy_class_id{ width:94px; - height:70px; + height:94px; border:1px solid #f1f1f1; background:#fff; text-align:center; - padding-top:24px; } .sy_class_id p{ font-size:16px;