From c5703e742ec2da13f73d9af2d7cf3346c177e9db Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 22 Aug 2017 10:13:02 +0800 Subject: [PATCH 01/22] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=88=90=E5=91=98=E4=B9=9F=E5=8F=AF=E4=BB=A5=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 23 +++++++++-------- app/helpers/application_helper.rb | 30 ++++++++-------------- app/helpers/student_work_helper.rb | 14 +++------- app/views/student_work/edit.html.erb | 8 +++++- 4 files changed, 33 insertions(+), 42 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 2fc74c135..a5ed47268 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -377,14 +377,14 @@ class StudentWorkController < ApplicationController end #开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 - if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) + if (@homework.is_open == 1 && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin? @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}") @show_all = true elsif User.current.member_of_course?(@course) if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 #学生 && 未开启匿评 只看到自己的 if @homework.homework_type == 3 - my_work = @homework.student_works.where(:user_id => User.current.id).first - @stundet_works = my_work ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.group_id) : [] + my_work = @homework.student_works.where(:user_id => User.current.id) + @stundet_works = !my_work.balnk? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : [] else @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id) end @@ -408,14 +408,14 @@ class StudentWorkController < ApplicationController end else - if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) + if (@homework.is_open == 1 && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin? @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}") @show_all = true elsif User.current.member_of_course?(@course) if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 #学生 && 未开启匿评 只看到自己的 if @homework.homework_type == 3 - my_work = @homework.student_works.where(:user_id => User.current.id).first - @stundet_works = my_work ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.group_id) : [] + my_work = @homework.student_works.where(:user_id => User.current.id) + @stundet_works = !my_work.blank? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : [] else @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id) end @@ -606,7 +606,7 @@ class StudentWorkController < ApplicationController render_403 else if @homework.homework_type == 3 - @commit_users = User.where(:id => @work.student_work_projects.map(&:user_id)) + @commit_users = User.where(:id => @homework.student_works.where("group_id = #{@work.group_id} and user_id != #{@work.user_id}").map(&:user_id)) end respond_to do |format| format.html{ render :layout => "base_edu"} @@ -624,9 +624,9 @@ class StudentWorkController < ApplicationController send_message_to_teacher(@work) if @homework.homework_type == 3 @student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first - student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0) - user_ids = student_work_projects.empty? ? "(-1)" : "(" + student_work_projects.map{|stu|stu.user_id}.join(",") + ")" - student_works = @homework.student_works.where("user_id in #{user_ids}") + student_work_projects = @homework.student_work_projects.where("student_work_id=? and user_id !=?",@student_work_project.student_work_id,User.current.id) + #user_ids = student_work_projects.empty? ? "(-1)" : "(" + student_work_projects.map{|stu|stu.user_id}.join(",") + ")" + student_works = @homework.student_works.where("group_id = #{@work.group_id} and user_id != #{@work.user_id}") student_works.each do |sw| course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(@homework.course_id, sw.user_id) if @work.work_status == 2 @@ -635,8 +635,9 @@ class StudentWorkController < ApplicationController course_statistics.update_attribute('committed_work_num', (course_statistics.committed_work_num - 1) < 0 ? 0 : (course_statistics.committed_work_num - 1)) if course_statistics course_statistics.update_attribute('un_commit_work_num', course_statistics.un_commit_work_num + 1) if course_statistics end - student_works.update_all(:work_status => 0, :description => nil, :project_id => 0, :late_penalty => 0,:work_status => 0, :commit_time => nil) + student_works.update_all(:work_status => 0, :description => nil, :project_id => 0, :late_penalty => 0,:work_status => 0, :commit_time => nil, :group_id => 0) student_work_projects.delete_all + @student_work_project.update_attributes(:is_leader => 1) members = params[:user_id] for i in 1 .. members.count-1 stu_work = @homework.student_works.where(:user_id=> members[i].to_i).empty? ? StudentWork.new : @homework.student_works.where(:user_id=> members[i].to_i).first diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4a6250c1e..2ddc4fa90 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3854,17 +3854,9 @@ module ApplicationHelper end end elsif work - if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 - if homework.homework_type != 3 - link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue homepagePostSubmit', :title => "开启匿评后不可修改作品" - else - work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")" - if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 - link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue homepagePostSubmit', :title => "开启匿评后不可修改作品" - else - link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue homepagePostSubmit', :title => "匿评开启后提交的作品不参与匿评" - end - end + work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")" + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 + link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue homepagePostSubmit', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status > 3 link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue homepagePostSubmit', :title => "匿评已结束" elsif homework.end_time >= Time.now && work.user_id == User.current.id @@ -3989,14 +3981,14 @@ module ApplicationHelper #获取当前用户在指定作业下提交的作业的集合 def cur_user_works_for_homework homework work = homework.student_works.where("user_id = ? && work_status != 0",User.current).first - if homework.homework_type == 3 - pro = homework.student_work_projects.where("user_id = #{User.current.id}").first - if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil? - work = nil - else - work = StudentWork.find pro.student_work_id - end - end + # if homework.homework_type == 3 + # pro = homework.student_work_projects.where("user_id = #{User.current.id}").first + # if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil? + # work = nil + # else + # work = StudentWork.find pro.student_work_id + # end + # end work end #获取当前用户在指定作业下关联的项目的集合 diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 65703baa7..215ed4ccc 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -116,17 +116,9 @@ module StudentWorkHelper myshixun = Myshixun.find work.myshixun_id link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "task-btn task-btn-blue fr mr10",:target => "_blank" if myshixun else - if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 - if homework.homework_type != 3 - link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品" - else - work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")" - if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 - link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品" - else - link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评开启后提交的作品不参与匿评" - end - end + work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")" + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 + link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status > 3 link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评已结束" elsif homework.end_time >= Time.now && work.user_id == User.current.id diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index 6b5e5d0c7..283a984e6 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -95,8 +95,14 @@
+ + + + + + <% @commit_users.each do |user| %> - + From b853f4bf165ecd0fe36848014fe7bdaee07d6c8d Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 22 Aug 2017 14:38:56 +0800 Subject: [PATCH 02/22] =?UTF-8?q?=E9=95=9C=E5=83=8F=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=9A=84model=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mirror_repository.rb | 5 +++++ app/models/mirror_repository_type.rb | 5 +++++ app/models/mirror_type.rb | 5 +++++ app/models/mirror_update_record.rb | 5 +++++ .../20170822032004_create_mirror_types.rb | 10 +++++++++ ...170822032223_create_mirror_repositories.rb | 14 ++++++++++++ ...22032810_create_mirror_repository_types.rb | 12 ++++++++++ ...0822062358_create_mirror_update_records.rb | 22 +++++++++++++++++++ spec/factories/mirror_repositories.rb | 10 +++++++++ spec/factories/mirror_repository_types.rb | 7 ++++++ spec/factories/mirror_types.rb | 6 +++++ spec/factories/mirror_update_records.rb | 16 ++++++++++++++ spec/models/mirror_repository_spec.rb | 5 +++++ spec/models/mirror_repository_type_spec.rb | 5 +++++ spec/models/mirror_type_spec.rb | 5 +++++ spec/models/mirror_update_record_spec.rb | 5 +++++ 16 files changed, 137 insertions(+) create mode 100644 app/models/mirror_repository.rb create mode 100644 app/models/mirror_repository_type.rb create mode 100644 app/models/mirror_type.rb create mode 100644 app/models/mirror_update_record.rb create mode 100644 db/migrate/20170822032004_create_mirror_types.rb create mode 100644 db/migrate/20170822032223_create_mirror_repositories.rb create mode 100644 db/migrate/20170822032810_create_mirror_repository_types.rb create mode 100644 db/migrate/20170822062358_create_mirror_update_records.rb create mode 100644 spec/factories/mirror_repositories.rb create mode 100644 spec/factories/mirror_repository_types.rb create mode 100644 spec/factories/mirror_types.rb create mode 100644 spec/factories/mirror_update_records.rb create mode 100644 spec/models/mirror_repository_spec.rb create mode 100644 spec/models/mirror_repository_type_spec.rb create mode 100644 spec/models/mirror_type_spec.rb create mode 100644 spec/models/mirror_update_record_spec.rb diff --git a/app/models/mirror_repository.rb b/app/models/mirror_repository.rb new file mode 100644 index 000000000..b6904e1b6 --- /dev/null +++ b/app/models/mirror_repository.rb @@ -0,0 +1,5 @@ +class MirrorRepository < ActiveRecord::Base + has_many :mirror_update_records + has_many :mirror_repository_types + attr_accessible :description, :mirrorID, :name, :status, :tag, :main_type +end diff --git a/app/models/mirror_repository_type.rb b/app/models/mirror_repository_type.rb new file mode 100644 index 000000000..4d1208ef4 --- /dev/null +++ b/app/models/mirror_repository_type.rb @@ -0,0 +1,5 @@ +class MirrorRepositoryType < ActiveRecord::Base + belongs_to :mirror_type + belongs_to :mirror_repository + # attr_accessible :title, :body +end diff --git a/app/models/mirror_type.rb b/app/models/mirror_type.rb new file mode 100644 index 000000000..0eb1f4dfd --- /dev/null +++ b/app/models/mirror_type.rb @@ -0,0 +1,5 @@ +class MirrorType < ActiveRecord::Base + belongs_to :user + has_many :mirror_repository_types + attr_accessible :name, :user_id +end diff --git a/app/models/mirror_update_record.rb b/app/models/mirror_update_record.rb new file mode 100644 index 000000000..9ef160e1a --- /dev/null +++ b/app/models/mirror_update_record.rb @@ -0,0 +1,5 @@ +class MirrorUpdateRecord < ActiveRecord::Base + belongs_to :user + belongs_to :mirror_repository + attr_accessible :newDescription, :newName, :newStatus, :newTag, :newType, :oldDescription, :oldName, :oldStatus, :oldTag, :oldType, :user_id, :mirror_repository_id +end diff --git a/db/migrate/20170822032004_create_mirror_types.rb b/db/migrate/20170822032004_create_mirror_types.rb new file mode 100644 index 000000000..956db2de1 --- /dev/null +++ b/db/migrate/20170822032004_create_mirror_types.rb @@ -0,0 +1,10 @@ +class CreateMirrorTypes < ActiveRecord::Migration + def change + create_table :mirror_types do |t| + t.string :name + t.references :user + + t.timestamps + end + end +end diff --git a/db/migrate/20170822032223_create_mirror_repositories.rb b/db/migrate/20170822032223_create_mirror_repositories.rb new file mode 100644 index 000000000..64223246f --- /dev/null +++ b/db/migrate/20170822032223_create_mirror_repositories.rb @@ -0,0 +1,14 @@ +class CreateMirrorRepositories < ActiveRecord::Migration + def change + create_table :mirror_repositories do |t| + t.string :mirrorID + t.string :name + t.string :main_type + t.string :tag + t.text :description + t.integer :status + + t.timestamps + end + end +end diff --git a/db/migrate/20170822032810_create_mirror_repository_types.rb b/db/migrate/20170822032810_create_mirror_repository_types.rb new file mode 100644 index 000000000..480f4fcb6 --- /dev/null +++ b/db/migrate/20170822032810_create_mirror_repository_types.rb @@ -0,0 +1,12 @@ +class CreateMirrorRepositoryTypes < ActiveRecord::Migration + def change + create_table :mirror_repository_types do |t| + t.references :mirror_type + t.references :mirror_repository + + t.timestamps + end + add_index :mirror_repository_types, :mirror_type_id + add_index :mirror_repository_types, :mirror_repository_id + end +end diff --git a/db/migrate/20170822062358_create_mirror_update_records.rb b/db/migrate/20170822062358_create_mirror_update_records.rb new file mode 100644 index 000000000..2e5efe4a4 --- /dev/null +++ b/db/migrate/20170822062358_create_mirror_update_records.rb @@ -0,0 +1,22 @@ +class CreateMirrorUpdateRecords < ActiveRecord::Migration + def change + create_table :mirror_update_records do |t| + t.references :user + t.references :mirror_repository + t.string :oldName + t.string :newName + t.string :oldType + t.string :newType + t.text :oldTag + t.text :newTag + t.text :oldDescription + t.text :newDescription + t.integer :oldStatus + t.integer :newStatus + + t.timestamps + end + add_index :mirror_update_records, :user_id + add_index :mirror_update_records, :mirror_repository_id + end +end diff --git a/spec/factories/mirror_repositories.rb b/spec/factories/mirror_repositories.rb new file mode 100644 index 000000000..e9c9b0429 --- /dev/null +++ b/spec/factories/mirror_repositories.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :mirror_repository do + mirrorID "MyString" +name "MyString" +tag "MyText" +description "MyText" +status 1 + end + +end diff --git a/spec/factories/mirror_repository_types.rb b/spec/factories/mirror_repository_types.rb new file mode 100644 index 000000000..c70850cf2 --- /dev/null +++ b/spec/factories/mirror_repository_types.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :mirror_repository_type do + mirror_type nil +mirror_repository nil + end + +end diff --git a/spec/factories/mirror_types.rb b/spec/factories/mirror_types.rb new file mode 100644 index 000000000..84557e448 --- /dev/null +++ b/spec/factories/mirror_types.rb @@ -0,0 +1,6 @@ +FactoryGirl.define do + factory :mirror_type do + name "MyString" + end + +end diff --git a/spec/factories/mirror_update_records.rb b/spec/factories/mirror_update_records.rb new file mode 100644 index 000000000..6bb631e82 --- /dev/null +++ b/spec/factories/mirror_update_records.rb @@ -0,0 +1,16 @@ +FactoryGirl.define do + factory :mirror_update_record do + user nil +oldName "MyString" +newName "MyString" +oldType "MyString" +newType "MyString" +oldTag "MyText" +newTag "MyText" +oldDescription "MyText" +newDescription "MyText" +oldStatus 1 +newStatus 1 + end + +end diff --git a/spec/models/mirror_repository_spec.rb b/spec/models/mirror_repository_spec.rb new file mode 100644 index 000000000..a991267d3 --- /dev/null +++ b/spec/models/mirror_repository_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MirrorRepository, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/mirror_repository_type_spec.rb b/spec/models/mirror_repository_type_spec.rb new file mode 100644 index 000000000..2f0f16796 --- /dev/null +++ b/spec/models/mirror_repository_type_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MirrorRepositoryType, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/mirror_type_spec.rb b/spec/models/mirror_type_spec.rb new file mode 100644 index 000000000..55eaafa94 --- /dev/null +++ b/spec/models/mirror_type_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MirrorType, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/mirror_update_record_spec.rb b/spec/models/mirror_update_record_spec.rb new file mode 100644 index 000000000..8460b7ebd --- /dev/null +++ b/spec/models/mirror_update_record_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MirrorUpdateRecord, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 0d4c234d51671cbd89cfa896eeeb44aa15b33c8c Mon Sep 17 00:00:00 2001 From: XuCheng642 <287102909@qq.com> Date: Thu, 24 Aug 2017 11:32:48 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E6=94=AF=E6=92=91=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E5=92=8C=E6=96=B0=E5=A2=9E=E5=AE=9E=E8=AE=AD=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 13 +++++++++++++ app/controllers/shixuns_controller.rb | 2 ++ app/models/syllabus.rb | 2 +- app/views/managements/_profession_list.html.erb | 17 +++++++++++++---- .../managements/applicable_course.html.erb | 2 +- app/views/managements/profession.html.erb | 14 +++++++++----- app/views/shixuns/_form.html.erb | 10 ++++++++-- config/routes.rb | 1 + 8 files changed, 48 insertions(+), 13 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 4aa241446..d14c86b2a 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -24,6 +24,11 @@ class ManagementsController < ApplicationController if first_level_discipline_option && first_level_discipline_option != '0' @syllabus=@syllabus.where(:first_level_discipline_id=>first_level_discipline_option) end + + if params[:support_shixuns] + @syllabus = @syllabus.where(:support_shixuns => params[:support_shixuns].to_i) + end + @syllabus = @syllabus.order("created_at #{@sx_order}") @syllabus_count = @syllabus.count limit = 20 @@ -37,6 +42,14 @@ class ManagementsController < ApplicationController end end + # 支撑实训 + def support_shixun + if params[:syllabus_id] + major = Syllabus.find params[:syllabus_id] + major.update_attributes(:support_shixuns => !major.support_shixuns) + end + end + # 实训适用课程 def applicable_course @menu_type = 12 diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 835b779a4..47f87ebf9 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -440,6 +440,7 @@ class ShixunsController < ApplicationController def new @shixun = Shixun.new + @support = Syllabus.where(:support_shixuns=> 1) respond_to do |format| format.html{render :layout => 'base_edu'} format.json @@ -699,4 +700,5 @@ class ShixunsController < ApplicationController render_403 if User.current.mail.blank? end + end diff --git a/app/models/syllabus.rb b/app/models/syllabus.rb index e893d9791..223e19917 100644 --- a/app/models/syllabus.rb +++ b/app/models/syllabus.rb @@ -30,7 +30,7 @@ class Syllabus < ActiveRecord::Base belongs_to :discipline_category belongs_to :first_level_discipline belongs_to :major - attr_accessible :description, :user_id, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course, :major_level, :discipline_category_id, :first_level_discipline_id, :major_id + attr_accessible :description, :user_id, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course, :major_level, :discipline_category_id, :first_level_discipline_id, :major_id,:support_shixuns safe_attributes 'title','user', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course', 'major_level', 'discipline_category_id', "first_level_discipline_id" validates :title, :user_id, presence: true diff --git a/app/views/managements/_profession_list.html.erb b/app/views/managements/_profession_list.html.erb index 6612c845d..4fe73edcc 100644 --- a/app/views/managements/_profession_list.html.erb +++ b/app/views/managements/_profession_list.html.erb @@ -19,10 +19,10 @@ - + <% end %> @@ -46,5 +46,14 @@ data: $("#profession").serialize(), dateType: "script" }); + }); + $("input[name='support_shixuns']").click(function(){ + var support_shixun_val = $(this).val(); + $.ajax({ + url:"<%= support_shixun_managements_path %>", + data: {syllabus_id: support_shixun_val}, + type: 'post', + dateType: "script" + }); }) diff --git a/app/views/managements/applicable_course.html.erb b/app/views/managements/applicable_course.html.erb index abcea4f78..4872bdd7a 100644 --- a/app/views/managements/applicable_course.html.erb +++ b/app/views/managements/applicable_course.html.erb @@ -3,7 +3,7 @@ 搜索清除 - 新增实训适用课程 + 新增课程 <% end %>
diff --git a/app/views/managements/profession.html.erb b/app/views/managements/profession.html.erb index 7f715457e..d7dae411d 100644 --- a/app/views/managements/profession.html.erb +++ b/app/views/managements/profession.html.erb @@ -7,11 +7,12 @@ 清除 新增 + + + +
- - - - + <% end %>
<%= render :partial => "managements/profession_list" %> @@ -23,5 +24,8 @@ $("#discipline_category_id").val(""); $("#first_level_discipline_id").val(""); $.get('<%= profession_managements_path() %>'); - } + }; + $("#join_course_role_0").on('click', function(){ + $("#profession").submit(); + }); \ No newline at end of file diff --git a/app/views/shixuns/_form.html.erb b/app/views/shixuns/_form.html.erb index 5ba904ebc..d8c99a8a8 100644 --- a/app/views/shixuns/_form.html.erb +++ b/app/views/shixuns/_form.html.erb @@ -39,9 +39,15 @@
  • - <%= select_tag :major_id, options_for_select(shixun_major_option, 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%> + <%#= select_tag :major_id, options_for_select(shixun_major_option, 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%> +
    - +
  • diff --git a/config/routes.rb b/config/routes.rb index 2c486d18b..618725247 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -202,6 +202,7 @@ RedmineApp::Application.routes.draw do get 'update_subject_hidden' post 'course_homepage_show' post 'shixun_homepage_show' + post 'support_shixun' post 'add_course' match 'add_major',:via=>[:get,:post] match 'approve_applied_schools',:via=>[:get,:post] From 71d8fd4420fb1246df37b68874398c8943e27959 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 24 Aug 2017 17:32:05 +0800 Subject: [PATCH 04/22] =?UTF-8?q?=E9=95=9C=E5=83=8F=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 85 +++++++++++ app/models/mirror_repository.rb | 4 +- app/models/mirror_repository_type.rb | 2 +- app/models/mirror_type.rb | 2 +- app/views/layouts/base_management.html.erb | 5 +- .../managements/_modify_mirror_modal.html.erb | 143 ++++++++++++++++++ .../managements/mirror_repository.html.erb | 129 ++++++++++++++++ app/views/managements/modify_mirror.js.erb | 2 + config/routes.rb | 5 + 9 files changed, 371 insertions(+), 6 deletions(-) create mode 100644 app/views/managements/_modify_mirror_modal.html.erb create mode 100644 app/views/managements/mirror_repository.html.erb create mode 100644 app/views/managements/modify_mirror.js.erb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 2ede27897..a87ed2ae8 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -6,6 +6,91 @@ class ManagementsController < ApplicationController include SortHelper include UsersHelper include ApplicationHelper + + # 镜像管理 + def mirror_repository + @menu_type = 3 + @sub_type = 4 + @mirror_types = MirrorType.where("0=0") + mirror_rep = Redmine::Configuration['mirror_rep'] + uri = "#{mirror_rep}/images/json" + uri = URI.parse(URI.encode(uri.strip)) + res = Net::HTTP.get(uri) + res = JSON.parse(res) + res.each do |mirror| + mirrorID = mirror['Id'][7, 12] + if MirrorRepository.where(:mirrorID => mirrorID).count == 0 + + end + end + end + + def add_mirror_type + data = {result: 0} + if params[:name] + if MirrorType.where(:name => params[:name]).count == 0 + new_type = MirrorType.new(:user_id => User.current.id, :name => params[:name]) + if new_type.save + data[:result] = 1 + end + else + data[:result] = 2 + end + end + render :json => data + end + + def modify_mirror + @mirror = MirrorRepository.find_by_mirrorID params[:mirrorID] + @mirror_types = MirrorType.where("0=0") + end + + def search_mirror_type + data = {mirror_types: []} + search = params[:search] + MirrorType.where("name like '%#{search}%'").each do |mirror_type| + option = [] + option << mirror_type.name.to_s + option << mirror_type.id + data[:mirror_types] << option + end + render :json => data + end + + def update_mirror + data = {result: 0, ID:""} + begin + mirror = MirrorRepository.find params[:mirror_id] + if mirror + last_index = params[:main_type].strip().rindex(";"); + params[:main_type] = last_index.nil? ? "" : params[:main_type].strip()[0 ... last_index] + if params[:main_type] != "" + if MirrorRepository.where("id != #{mirror.id} and main_type = #{params[:main_type]} and tag = #{params[:tag].strip()}").count > 0 + data[:result] = 1 + data[:ID] = MirrorRepository.where("id != #{mirror.id} and main_type = #{params[:main_type]} and tag = #{params[:tag].strip()}").first.mirrorID + else + main_types = params[:main_type].split(";") + mirror.mirror_repository_types.destroy_all + main_types.each do |type| + mirror_tp = MirrorType.where(:name => type).first + if mirror_tp + MirrorRepositoryType.create(:mirror_type_id => mirror_tp.id, :mirror_repository_id => mirror.id) + end + end + mirror.update_attributes(:main_type => params[:main_type], :tag => params[:tag], :description => params[:description], :status => params[:status]) + end + else + data[:result] = 2 + end + else + data[:result] = 3 + end + rescue Exception => e + puts e + end + render :json => data + end + # 专业列表 def profession @syllabus=Syllabus.where("0=0") diff --git a/app/models/mirror_repository.rb b/app/models/mirror_repository.rb index b6904e1b6..5a6525b41 100644 --- a/app/models/mirror_repository.rb +++ b/app/models/mirror_repository.rb @@ -1,5 +1,5 @@ class MirrorRepository < ActiveRecord::Base - has_many :mirror_update_records - has_many :mirror_repository_types + has_many :mirror_update_records, :dependent => :destroy + has_many :mirror_repository_types, :dependent => :destroy attr_accessible :description, :mirrorID, :name, :status, :tag, :main_type end diff --git a/app/models/mirror_repository_type.rb b/app/models/mirror_repository_type.rb index 4d1208ef4..ff74c4591 100644 --- a/app/models/mirror_repository_type.rb +++ b/app/models/mirror_repository_type.rb @@ -1,5 +1,5 @@ class MirrorRepositoryType < ActiveRecord::Base belongs_to :mirror_type belongs_to :mirror_repository - # attr_accessible :title, :body + attr_accessible :mirror_type_id, :mirror_repository_id end diff --git a/app/models/mirror_type.rb b/app/models/mirror_type.rb index 0eb1f4dfd..9d78ce4fb 100644 --- a/app/models/mirror_type.rb +++ b/app/models/mirror_type.rb @@ -1,5 +1,5 @@ class MirrorType < ActiveRecord::Base belongs_to :user - has_many :mirror_repository_types + has_many :mirror_repository_types, :dependent => :destroy attr_accessible :name, :user_id end diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index 5fb3d215f..7e372bbc4 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -9,7 +9,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/edu-common', 'css/edu-public', 'css/font-awesome', 'css/edu-popup', 'css/magic-check', "css/edu-admin" %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/edu-common', 'css/edu-public', 'css/font-awesome', 'css/edu-popup', 'css/magic-check', "css/edu-admin", "css/moduel", "css/taskstyle" %> <%= javascript_include_tag "edu/application",'edu/base_edu', 'baiduTemplate', 'jquery.datetimepicker.js', "edu/management" %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -28,7 +28,7 @@ <% when 2 %> <%= @sub_type == 1 ? "课程列表" : "班级列表" %> <% when 3 %> - <%= @sub_type == 1 ? "实训列表" :(@sub_type == 2? "已发布的实训":"已关闭的实训") %> + <%= @sub_type == 1 ? "实训列表" :(@sub_type == 2 ? "已发布的实训": (@sub_type == 3 ? "已关闭的实训": "镜像管理")) %> <% when 4 %> <%= @sub_type == 1 ? "实训套件" : "已发布实训套件" %> <% when 5 %> @@ -63,6 +63,7 @@
  • <%= link_to "实训列表", shixuns_managements_path %>
  • <%= link_to "已发布的实训", publish_shixuns_managements_path %>
  • <%= link_to "已关闭的实训", close_shixuns_managements_path %>
  • +
  • <%= link_to "镜像管理", mirror_repository_managements_path %>
  • 实训套件+ diff --git a/app/views/managements/_modify_mirror_modal.html.erb b/app/views/managements/_modify_mirror_modal.html.erb new file mode 100644 index 000000000..74eb14647 --- /dev/null +++ b/app/views/managements/_modify_mirror_modal.html.erb @@ -0,0 +1,143 @@ +
    +
    +

    镜像修改

    + +
    +
    +
    +
    + + + +
    +
    + +
    + +
      +
    +
    +
    + 请至少选择一个主类别 +
    +
    + +
    + +
    +
    + 小类别不能为空 +
    +
    + + +
    +
    + + + + + + + + + +
    +
    + + +
    +
    + 确定 + 取消 +
    +
    + + \ No newline at end of file diff --git a/app/views/managements/mirror_repository.html.erb b/app/views/managements/mirror_repository.html.erb new file mode 100644 index 000000000..2b6c6070e --- /dev/null +++ b/app/views/managements/mirror_repository.html.erb @@ -0,0 +1,129 @@ +
    +
    + +
    + <% @mirror_types.each do |type| %> + <%= type.name %> + <% end %> + + +添加 +
    +
    + +
    +
  • <%= @work.user.show_real_name %><%= @work.user.user_extensions.try(:student_id) %><%= @course.members.where(:user_id => @work.user.id).first.course_group.try(:name) %>
    <%= user.show_real_name %> <%= user.user_extensions.try(:student_id) %> <%= @course.members.where(:user_id => user.id).first.course_group.try(:name) %><%= syllabus.syllabus_first_level_discipline == "" ? "--" : syllabus.syllabus_first_level_discipline %> <%= syllabus.syllabus_major == "" ? "--" : syllabus.syllabus_major %> <%= format_time syllabus.created_at %> - - - + class="mr5 magic-checkbox" id="join_course_role_<%= syllabus.id%>"> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    序号镜像ID镜像名称镜像主类别镜像小类别镜像描述状态修改时间操作
    1drfhuko4java1.8-jfinal5.0 +

    java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;

    + + + +
    +

    docert1.5;centos2.5;

    + +
    镜像是。。。。未发布2017-08-15 10:34 + 删除 + <%= link_to '修改', modify_mirror_managements_path(:mirrorID => '1232423'), :class => "color-blue update_table_date", :remote => true %> + 保存 +
    2edftg3grpython3.6-mysql1.5 +

    java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;

    + + + +
    +

    docert1.5;centos2.5;

    + + +
    镜像是。。。。已发布2017-08-15 10:34 + 修改 + 保存 +
    +
    + + + \ No newline at end of file diff --git a/app/views/managements/modify_mirror.js.erb b/app/views/managements/modify_mirror.js.erb new file mode 100644 index 000000000..0e3d9e0d5 --- /dev/null +++ b/app/views/managements/modify_mirror.js.erb @@ -0,0 +1,2 @@ +var html_value = "<%= escape_javascript(render :partial => 'managements/modify_mirror_modal') %>"; +pop_box_new(html_value, 500, 430); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3d142e4cb..a0dd65ce3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -164,6 +164,11 @@ RedmineApp::Application.routes.draw do resources :managements do collection do + get 'mirror_repository' + post 'add_mirror_type' + get 'modify_mirror' + post 'search_mirror_type' + post 'update_mirror' match 'applicable_course',:via=>[:get,:post] match 'profession',:via=>[:get,:post] match 'shixuns', :via => [:get, :post] From 55392a29b32cb597c9026c018ef06a83e3d03cd6 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 24 Aug 2017 17:36:49 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_courseList.html.erb | 2 +- app/views/games/_games_list.html.erb | 6 +- .../_homework_bank_list.html.erb | 11 +- app/views/shixuns/_form.html.erb | 7 ++ app/views/subjects/_subject_list.html.erb | 64 ++++++++--- app/views/subjects/_subject_top.html.erb | 68 ++++-------- app/views/subjects/show.html.erb | 102 ++++++++---------- app/views/syllabuses/show.html.erb | 4 +- public/stylesheets/css/edu-common.css | 4 +- public/stylesheets/css/edu-subject.css | 53 +++++++-- 10 files changed, 183 insertions(+), 138 deletions(-) diff --git a/app/views/courses/_courseList.html.erb b/app/views/courses/_courseList.html.erb index cdd07a2bd..cf10ed024 100644 --- a/app/views/courses/_courseList.html.erb +++ b/app/views/courses/_courseList.html.erb @@ -58,7 +58,7 @@ <% else %> -
    +

    没有数据可以显示!

    diff --git a/app/views/games/_games_list.html.erb b/app/views/games/_games_list.html.erb index c8c20fe1c..73b3c0c9d 100644 --- a/app/views/games/_games_list.html.erb +++ b/app/views/games/_games_list.html.erb @@ -30,9 +30,9 @@ <% elsif game.try(:status) == 2 %> <% final_score = (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : game.final_score.to_i %> <% gold_score = @myshixun.shixun.status <= 1 ? 0 : (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) %> - 经验值+<%= final_score %> - 金币 mr5"><%= gold_score < 0 ? gold_score : "+"+gold_score.to_s %> - 技能标签+<%= (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : challenge.challenge_tags.count %> + 经验值+<%= final_score %> + 金币 ml5"><%= gold_score < 0 ? gold_score : "+"+gold_score.to_s %> + 技能标签+<%= (game.answer_open? || @myshixun.shixun.status <= 1) ? 0 : challenge.challenge_tags.count %> <% end %>
    diff --git a/app/views/homework_bank/_homework_bank_list.html.erb b/app/views/homework_bank/_homework_bank_list.html.erb index 831c294ed..e2dbc582b 100644 --- a/app/views/homework_bank/_homework_bank_list.html.erb +++ b/app/views/homework_bank/_homework_bank_list.html.erb @@ -1,7 +1,9 @@
    -
    - - +
    +
    + + +

    <%= @hw_count %>个搜索结果

    @@ -9,6 +11,7 @@ | <%= link_to '更新时间排序', homework_bank_index_path(:type => @type, :order => "updated_at", :search => @search, :sort => @r_sort, :property=>@property), :class => "fr #{@order == 'updated_at' ? 'color-blue' : ''}", :remote => true %>
    +

    <%= link_to '全部', homework_bank_index_path(:type => @type), :class => 'edu-filter-cir-grey mr5 active font-12 fl', :id => 'homework_bank_pro_0', :remote => true %> @@ -70,7 +73,7 @@ <%= render :partial => 'welcome/no_data' %> <% end %>

    - +
      diff --git a/app/views/shixuns/_form.html.erb b/app/views/shixuns/_form.html.erb index 571e4f9e1..d42eec410 100644 --- a/app/views/shixuns/_form.html.erb +++ b/app/views/shixuns/_form.html.erb @@ -62,6 +62,13 @@ <%= select_tag :language, options_for_select(shixun_language, "Java"), :id => 'shixun_language', :class => "fl task-form-10 task-height-40" %> +
    • 提交 <%= link_to "取消", shixuns_path, :class => "task-btn fr mr10" %> diff --git a/app/views/subjects/_subject_list.html.erb b/app/views/subjects/_subject_list.html.erb index 61f53afdf..415315e24 100644 --- a/app/views/subjects/_subject_list.html.erb +++ b/app/views/subjects/_subject_list.html.erb @@ -14,20 +14,20 @@
    <% else %> <% @subjects.each do |subject| %> -
    - <% if subject.status < 2 && !User.current.manager_of_subject?(subject) %> + +
    +
    + <% if subject.status < 2 && !User.current.manager_of_subject?(subject) %> +
    +
    +
    非试用内容,需要授权
    +
    + <% end %> +
    +

    + <%= subject.name %> +

    +

    + 计算思维导论计算思维导论计算思维导论计算思维导论计算思维导论计算思维导论计算思维导论计算思维导论计算思 +

    +

    + <%= subject.stage_shixuns.count %> + <%= subject.stage_shixuns.count %> + <%= subject.subject_score %> + <%= subject.subject_challenges %> +

    +
    + <%= image_tag(url_to_avatar(subject.user), :width =>"40", :height => "40", :class => "bor-radius-all mr10 fl mt8", :alt=>"头像") %> +
    +

    <%= subject.user.try(:show_name) %>

    +

    国防科学技术大学讲师国防科学技术大学讲师

    +
    +
    +
    +
    +
    +
    +
    <% end %> <% end %>
    diff --git a/app/views/subjects/_subject_top.html.erb b/app/views/subjects/_subject_top.html.erb index 5a4f09598..50dc1ca96 100644 --- a/app/views/subjects/_subject_top.html.erb +++ b/app/views/subjects/_subject_top.html.erb @@ -1,23 +1,37 @@
    -

    +

    <%= @subject.name %> + <% if User.current.manager_of_subject?(@subject) && @subject.status == 0 %> + + <% end %> +

    +

    <% if !@subject.user.user_extensions.school_id.blank? && @subject.user.user_extensions.school %> <%= @subject.user.user_extensions.school.name %>   <% end %> <%= @subject.user.show_name %>

    -

    <%= @subject.name %>

    <%# if User.current.manager_of_subject?(@subject) && @subject.status == 0 %> <%# end %> - <% if !User.current.manager_of_subject?(@subject) || @subject.status > 1 %> -
      -
    • <%= @subject.stage_shixuns.count %>
    • -
    • <%= @subject.subject_challenges %>
    • -
    • <%= @subject.subject_score %>
    • + <%# if !User.current.manager_of_subject?(@subject) || @subject.status > 1 %> +
        +
      • 5 章节
      • +
      • <%= @subject.stage_shixuns.count %> 实训
      • +
      • + + + + 5 选择题任务 +
      • +
      • + + 5 实践任务 +
      • +
      • <%= @subject.subject_score %> 经验值
      - <% elsif @subject.status == 0 && @subject.stages.count > 0 && User.current.manager_of_subject?(@subject) %> + <% if @subject.status == 0 && @subject.stages.count > 0 && User.current.manager_of_subject?(@subject) %> <%= link_to '申请发布', publish_subject_path(@subject), :class => "course-btn fr", :remote => true %> <% elsif @subject.status == 1 && User.current.manager_of_subject?(@subject) %> <%= link_to '撤销申请', cancel_publish_subject_path(@subject), :class => "course-btn fr" %> @@ -25,41 +39,3 @@
    - - \ No newline at end of file diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 3f9bc01da..3b3448364 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -1,93 +1,62 @@ +
    <% if !@subject.description.blank? || (User.current.manager_of_subject?(@subject) && @subject.status == 0) %> -
    +

    - 简介 <% if User.current.manager_of_subject?(@subject) && @subject.status == 0 %> <% end %>

    -
    - <%= @subject.description.blank? ? "暂未填写" : @subject.description %> +
    + <%= @subject.description.blank? ? "暂未填写" : "简介:"+@subject.description %>
    <% end %> -
    <% count = 0 %> <% @stages.each do |stage| %> -
    +

    - - <%= stage.name %> + + 第一章  <%= stage.name %> <% if @subject.status == 0 && User.current.manager_of_subject?(@subject) %> - - + + + <% else %> + <% end %>

    -

    <%= stage.description %>

    +
    +

    描述<%= stage.description %>

    <% stage.stage_shixuns.each_with_index do |stage_shixun, index| %> <% shixun = stage_shixun.shixun %> -
    +
  • - <%= count = count + 1 %> - + <%= shixun.name %>
  • -
  • - - <%= shixun.challenges.count %> -
  • -
  • - <%= shixun.shixun_score %>
  • -
  • +
  • <% if @subject.status == 0 && User.current.manager_of_subject?(@subject) %> <%= shixun.shixun_status %> <% else %> <% case my_shixun_status(shixun, User.current) %> <% when '已通关' %> - + 已通关   <% when '未通关' %> - + 未通关   <% when '未开启' %> - + 未开启   <% end %> <% end %>
  • +
  • + 开始实战 +
  • <% end %> +
    <% end %>
    @@ -133,7 +102,25 @@ +点击新建阶段(选择1至多个实训项目,组成一个阶段)
    <% end %> - +
    +
    +
    +

    学习须知

    +

    数据结构是计算机存储、组织数据的方式。数据结构是指相互之间存在一种或多种特定关系的数据元素的集合。通常情况下,精心选择的数据结构可以带来更高的运行或者存储效率。数据结构往往同高效的检索算法和索引技术有关。

    +
    +
    +

    教学名师

    +
    +

    +

    蔡世

    +

    国防科学技术大学讲师

    +
    +

    数据结构是计算机存储、组织数据的方式。数据结构是指相互之间存在一种或多种特定关系的数据元素的集合。通常情况下,精心选择的数据结构可以带来更高的运行或者存储效率。数据结构往往同高效的检索算法和索引技术有关。

    + +
    +
    \ No newline at end of file diff --git a/app/views/syllabuses/show.html.erb b/app/views/syllabuses/show.html.erb index d3998cba0..f742d8242 100644 --- a/app/views/syllabuses/show.html.erb +++ b/app/views/syllabuses/show.html.erb @@ -30,7 +30,7 @@ <% if @is_syllabus_admin %>
  • - +
  • @@ -67,7 +67,7 @@

      授课大纲

      - + diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index da653276b..0951ebac5 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -20,7 +20,7 @@
    • <%#= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "new-nav-a", :target=>"_blank" %>
    • -->
    • <%= link_to "全部实训", shixuns_path, :class => "new-nav-a font-16" %>
    • -
    • <%= link_to "实训套件", subjects_path, :class => "new-nav-a font-16" %>
    • +
    • <%= link_to "实训课程", subjects_path, :class => "new-nav-a font-16" %>
    • <%= link_to "在线课堂", courses_path, :class => "new-nav-a font-16" %>
    diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index 7e372bbc4..5adbee8f3 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -30,7 +30,7 @@ <% when 3 %> <%= @sub_type == 1 ? "实训列表" :(@sub_type == 2 ? "已发布的实训": (@sub_type == 3 ? "已关闭的实训": "镜像管理")) %> <% when 4 %> - <%= @sub_type == 1 ? "实训套件" : "已发布实训套件" %> + <%= @sub_type == 1 ? "实训课程" : "已发布实训套件" %> <% when 5 %> 竞赛 <% when 6 %> @@ -66,7 +66,7 @@
  • <%= link_to "镜像管理", mirror_repository_managements_path %>
  • -
  • 实训套件+ +
  • 实训课程+
    • <%= link_to "实训套件列表", class_shixuns_managements_path %>
    • <%= link_to "已发布实训套件", class_publish_shixuns_managements_path %>
    • diff --git a/app/views/subjects/_subject_createnew.html b/app/views/subjects/_subject_createnew.html index a86d57578..328c09aae 100644 --- a/app/views/subjects/_subject_createnew.html +++ b/app/views/subjects/_subject_createnew.html @@ -18,7 +18,7 @@

      - kosasa > 实训套件 + kosasa > 实训课程 >新建

      diff --git a/app/views/subjects/_subject_list.html.erb b/app/views/subjects/_subject_list.html.erb index 415315e24..f2e2641b4 100644 --- a/app/views/subjects/_subject_list.html.erb +++ b/app/views/subjects/_subject_list.html.erb @@ -72,19 +72,19 @@ <%= subject.name %>

      - 计算思维导论计算思维导论计算思维导论计算思维导论计算思维导论计算思维导论计算思维导论计算思维导论计算思 + <%= subject.introduction.blank? ? "轻松学习#{subject.name}~" : subject.introduction %>

      - <%= subject.stage_shixuns.count %> - <%= subject.stage_shixuns.count %> - <%= subject.subject_score %> - <%= subject.subject_challenges %> + <%= subject.stages.count %> + <%= subject.stage_shixuns.count %> + <%= subject.subject_score %> + <%= subject.subject_challenges %>

      <%= image_tag(url_to_avatar(subject.user), :width =>"40", :height => "40", :class => "bor-radius-all mr10 fl mt8", :alt=>"头像") %>

      <%= subject.user.try(:show_name) %>

      -

      国防科学技术大学讲师国防科学技术大学讲师

      +

      <%= subject.user.school_name + subject.user.identity %>

      diff --git a/app/views/subjects/_subject_top.html.erb b/app/views/subjects/_subject_top.html.erb index 50dc1ca96..597ba93b9 100644 --- a/app/views/subjects/_subject_top.html.erb +++ b/app/views/subjects/_subject_top.html.erb @@ -1,8 +1,8 @@

      <%= @subject.name %> - <% if User.current.manager_of_subject?(@subject) && @subject.status == 0 %> - + <% if User.current.manager_of_subject?(@subject) %> + <% end %>

      @@ -17,17 +17,15 @@ <%# end %> <%# if !User.current.manager_of_subject?(@subject) || @subject.status > 1 %>

        -
      • 5 章节
      • +
      • <%= @subject.stages.count %> 章节
      • <%= @subject.stage_shixuns.count %> 实训
      • - - - 5 选择题任务 + <%= @subject.subject_choices %> 选择题任务
      • - 5 实践任务 + <%= @subject.subject_shixuns %> 实践任务
      • <%= @subject.subject_score %> 经验值
      diff --git a/app/views/subjects/edit.html.erb b/app/views/subjects/edit.html.erb index 623057ba3..e98e98f58 100644 --- a/app/views/subjects/edit.html.erb +++ b/app/views/subjects/edit.html.erb @@ -1,7 +1,7 @@

      - <%= link_to User.current.show_name, user_path(User.current) %> > <%= link_to "实训套件", subjects_path() %> + <%= link_to User.current.show_name, user_path(User.current) %> > <%= link_to "实训课程", subjects_path() %> > 编辑

      @@ -15,6 +15,18 @@
      请输入名称 +
    • + + +
      + 请输入描述 +
    • +
    • + + +
      + 请输入学习须知 +
    • diff --git a/app/views/subjects/new.html.erb b/app/views/subjects/new.html.erb index 9ad122938..e38f0c6ef 100644 --- a/app/views/subjects/new.html.erb +++ b/app/views/subjects/new.html.erb @@ -1,7 +1,7 @@

      - <%= link_to User.current.show_name, user_path(User.current) %> > <%= link_to "实训套件", subjects_path() %> + <%= link_to User.current.show_name, user_path(User.current) %> > <%= link_to "实训课程", subjects_path() %> > 新建

      @@ -11,14 +11,22 @@ <%= labelled_form_for @subject do |f| %>
    • - +
      请输入名称
    • - + +
      + 请输入描述 + +
    • + + +
      + 请输入学习须知 +
    • diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 3b3448364..b0ed8e461 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -1,9 +1,9 @@
      -<% if !@subject.description.blank? || (User.current.manager_of_subject?(@subject) && @subject.status == 0) %> +<% if !@subject.description.blank? || User.current.manager_of_subject?(@subject) %>

      - <% if User.current.manager_of_subject?(@subject) && @subject.status == 0 %> + <% if User.current.manager_of_subject?(@subject) %> <% end %>

      @@ -15,11 +15,11 @@
      <% count = 0 %> - <% @stages.each do |stage| %> + <% @stages.each_with_index do |stage, index| %>

      - 第一章  <%= stage.name %> + 第<%= index + 1 %>章  <%= stage.name %> <% if @subject.status == 0 && User.current.manager_of_subject?(@subject) %> @@ -28,7 +28,7 @@ <% end %>

      -

      描述<%= stage.description %>

      +

      <%= stage.description %>

      <% stage.stage_shixuns.each_with_index do |stage_shixun, index| %> <% shixun = stage_shixun.shixun %>
      @@ -37,9 +37,8 @@ <%= shixun.name %>
    • - <% if @subject.status == 0 && User.current.manager_of_subject?(@subject) %> + <% if @subject.status < 2 %> <%= shixun.shixun_status %> - <% else %> <% case my_shixun_status(shixun, User.current) %> <% when '已通关' %> @@ -50,9 +49,12 @@ 未开启   <% end %> <% end %> -
    • -
    • - 开始实战 + <% myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => shixun.id).first %> + <% if myshixun.blank? %> + <%= link_to "开始实战", shixun_path(shixun), :class => "task-btn task-btn-orange" %> + <% else %> + <%= link_to "继续实战", shixun_path(shixun), :class => "task-btn task-btn-orange" %> + <% end %>
    • <% end %> @@ -105,17 +107,21 @@
      -

      学习须知

      -

      数据结构是计算机存储、组织数据的方式。数据结构是指相互之间存在一种或多种特定关系的数据元素的集合。通常情况下,精心选择的数据结构可以带来更高的运行或者存储效率。数据结构往往同高效的检索算法和索引技术有关。

      +

      学习须知 + <% if User.current.manager_of_subject?(@subject) %> + + <% end %> +

      +

      <%= @subject.learning_notes.blank? ? "暂未填写" : @subject.learning_notes %>

      教学名师

      -

      -

      蔡世

      -

      国防科学技术大学讲师

      +

      <%= image_tag(url_to_avatar(@subject.user), :width =>"40", :height => "40", :class => "bor-radius-all", :alt=>"头像") %>

      +

      <%= @subject.user.try(:show_name) %>

      +

      <%= @subject.user.school_name + @subject.user.identity %>

      -

      数据结构是计算机存储、组织数据的方式。数据结构是指相互之间存在一种或多种特定关系的数据元素的集合。通常情况下,精心选择的数据结构可以带来更高的运行或者存储效率。数据结构往往同高效的检索算法和索引技术有关。

      +

      <%= @subject.user.user_extensions.brief_introduction.blank? ? "暂未填写" : @subject.user.user_extensions.brief_introduction %>

      diff --git a/db/migrate/20170824103529_add_learning_notes_to_subjects.rb b/db/migrate/20170824103529_add_learning_notes_to_subjects.rb new file mode 100644 index 000000000..e134875b9 --- /dev/null +++ b/db/migrate/20170824103529_add_learning_notes_to_subjects.rb @@ -0,0 +1,6 @@ +class AddLearningNotesToSubjects < ActiveRecord::Migration + def change + add_column :subjects, :learning_notes, :text + add_column :subjects, :introduction, :string + end +end diff --git a/public/javascripts/edu/base_edu.js b/public/javascripts/edu/base_edu.js index cf57c69d0..b19c4a6fc 100644 --- a/public/javascripts/edu/base_edu.js +++ b/public/javascripts/edu/base_edu.js @@ -1023,19 +1023,51 @@ function destroy_all_hb(url){ } function submit_new_subject(){ + var check = true; if($("#new_subject_name").val().trim() == ""){ + check = false; $("#new_subject_name_notice").show(); } else{ $("#new_subject_name_notice").hide(); + } + if($("#new_subject_intro").val().trim() == ""){ + check = false; + $("#new_subject_intro_notice").show(); + } else{ + $("#new_subject_intro_notice").hide(); + } + if($("#new_learning_notes").val().trim() == ""){ + check = false; + $("#new_learning_notes_notice").show(); + } else { + $("#new_learning_notes_notice").hide(); + } + if(check){ $("#new_subject").submit(); } } function submit_edit_subject(id){ + var check = true; if($("#new_subject_name").val().trim() == ""){ + check = false; $("#new_subject_name_notice").show(); } else{ $("#new_subject_name_notice").hide(); + } + if($("#new_subject_intro").val().trim() == ""){ + check = false; + $("#new_subject_intro_notice").show(); + } else{ + $("#new_subject_intro_notice").hide(); + } + if($("#new_learning_notes").val().trim() == ""){ + check = false; + $("#new_learning_notes_notice").show(); + } else { + $("#new_learning_notes_notice").hide(); + } + if(check){ $("#edit_subject_"+id).submit(); } } \ No newline at end of file From 2a997d4491e8ca2173a3ec4d08b4d63a46f5a8dd Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 24 Aug 2017 20:05:02 +0800 Subject: [PATCH 07/22] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=A5=97=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/show.html.erb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index b0ed8e461..cf5451340 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -49,11 +49,13 @@ 未开启   <% end %> <% end %> - <% myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => shixun.id).first %> - <% if myshixun.blank? %> - <%= link_to "开始实战", shixun_path(shixun), :class => "task-btn task-btn-orange" %> - <% else %> - <%= link_to "继续实战", shixun_path(shixun), :class => "task-btn task-btn-orange" %> + <% if shixun.status > 1 %> + <% myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => shixun.id).first %> + <% if myshixun.blank? %> + <%= link_to "开始实战", shixun_path(shixun), :class => "task-btn task-btn-orange" %> + <% else %> + <%= link_to "继续实战", shixun_path(shixun), :class => "task-btn task-btn-orange" %> + <% end %> <% end %>
      From a6971b380f407e5fcbc742f951bd05ae2e005b23 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 24 Aug 2017 20:10:45 +0800 Subject: [PATCH 08/22] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E9=82=AE=E7=AE=B1=E5=8E=BB=E6=96=B0=E5=BB=BA=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?/=E5=BC=80=E5=90=AF=E5=AE=9E=E6=88=98=E6=97=B6=E7=BB=99?= =?UTF-8?q?=E5=87=BA=E5=8E=BB=E7=BB=91=E5=AE=9A=E9=82=AE=E7=AE=B1=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=8C=E7=82=B9=E5=87=BB=E5=8E=BB=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E5=90=8E=E9=9C=80=E8=A6=81=E6=96=B0=E5=BC=80=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/operation.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shixuns/operation.js.erb b/app/views/shixuns/operation.js.erb index 2ff2b7ee1..c1ebe2f8f 100644 --- a/app/views/shixuns/operation.js.erb +++ b/app/views/shixuns/operation.js.erb @@ -1,5 +1,5 @@ <% if @mail %> - notice_box_redirect('#{security_settings_path}', '开启实训,请先绑定邮箱'); + sure_box_redirect('#{security_settings_path}', '开启实训,请先绑定邮箱'); <% else %> <% if @is_modify.blank? %> //为了防止浏览器阻挡 From 68a901a5334ec9bb50d0ee46e4e879e155355e54 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 24 Aug 2017 20:12:27 +0800 Subject: [PATCH 09/22] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E6=96=99?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=82=B9=E5=87=BB=E5=AE=89=E5=85=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=AD=E7=BB=91=E5=AE=9A=E6=88=96=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E5=B7=A6=E8=BE=B9=E6=A0=8F=E7=9B=AE=E4=BC=9A=E8=B7=B3?= =?UTF-8?q?=E5=88=B0=E2=80=9C=E8=81=8C=E4=B8=9A=E8=AE=A4=E8=AF=81=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 6f838f5a5..b436422db 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -632,7 +632,7 @@ class AccountController < ApplicationController def change_or_bind @user = User.current @type = params[:type] - @setting_type = 4 + @setting_type = 5 render :layout => 'base_edu_account' end From 8febb20612f308b510d9b0576602885bb7675c37 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 25 Aug 2017 09:44:57 +0800 Subject: [PATCH 10/22] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E8=B5=84=E6=96=99?= =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E5=96=84=E6=97=B6=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/my_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 0a6050e94..6983f4678 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -151,7 +151,7 @@ class MyController < ApplicationController ue = @user.user_extensions @trail_authentication = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization").order("created_at desc").first @authentication = @user.authentication - if ue.identity.nil? + if @user.nickname.nil? || @user.lastname.nil? || ue.identity.nil? || ue.location.nil? || ue.school_id.nil? @require_auth = true else if @trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 24*60*60) < Time.now.to_i) From 3e2d6d6b3765075bdea37769cbf9781035c2206e Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 25 Aug 2017 10:29:32 +0800 Subject: [PATCH 11/22] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E5=BC=80=E5=A7=8B=E5=AE=9E=E6=88=98=E5=92=8C=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E5=AE=9E=E6=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index cf5451340..25332ef71 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -52,9 +52,9 @@ <% if shixun.status > 1 %> <% myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => shixun.id).first %> <% if myshixun.blank? %> - <%= link_to "开始实战", shixun_path(shixun), :class => "task-btn task-btn-orange" %> + <%= link_to "开始实战", operation_shixun_path(shixun, :myshixun_id => myshixun.try(:id)), :class => "task-btn task-btn-orange", :id => "shixun_operation", :remote => true %> <% else %> - <%= link_to "继续实战", shixun_path(shixun), :class => "task-btn task-btn-orange" %> + <%= link_to "继续实战", operation_shixun_path(shixun, :myshixun_id => myshixun.try(:id)), :class => "task-btn task-btn-orange", :id => "shixun_operation", :remote => true %> <% end %> <% end %> From 2a9e8a09690c06747645e23e86edc1b544e2920f Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 25 Aug 2017 10:36:41 +0800 Subject: [PATCH 12/22] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E9=9D=A2=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E6=B8=90=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/edu-subject.css | 3 +-- public/stylesheets/css/taskstyle.css | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/public/stylesheets/css/edu-subject.css b/public/stylesheets/css/edu-subject.css index d52ddc86b..017775fff 100644 --- a/public/stylesheets/css/edu-subject.css +++ b/public/stylesheets/css/edu-subject.css @@ -1,6 +1,5 @@ /*------课程实训首页---------*/ -/*background: linear-gradient(to right, rgb(68, 190, 164) 0%, rgb(62, 158, 207) 100%);*/ -.header-color{padding: 30px;background-image: url("../images/subject.jpg");background-size: 100%;} +.header-color{padding: 30px;background: linear-gradient(to right, rgb(68, 190, 164) 0%, rgb(62, 158, 207) 100%);} .box_bg_shandow{box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);} .active-class .content .pre_sub-con{width:23.87%;margin: 0 1.5% 2.55% 0px;height: 269px;} diff --git a/public/stylesheets/css/taskstyle.css b/public/stylesheets/css/taskstyle.css index 9f62b0158..8441f3546 100644 --- a/public/stylesheets/css/taskstyle.css +++ b/public/stylesheets/css/taskstyle.css @@ -221,11 +221,10 @@ input.knowledge_frame{height:28px;line-height:28px;border:none;background:#f3f5f .task-index{ width: 1200px; margin:0 auto;} .task-index-head{ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15); } /*.task-index-head-top{background-image: linear-gradient(to right, rgb(106, 177, 216) 0%, rgb(1, 74, 78) 100%);background-color: rgb(1, 70, 74); padding:30px;}*/ - -/*background-color: rgb(1, 70, 74);background: linear-gradient(to right, rgb(104, 177, 215) 0%, rgb(1,75,79) 100%);*/ -.task-index-head-top{background-image: url(../images/shixun.jpg);background-size:100% 100%; padding:30px;} -.task-index-head-top-course{background-image: url("../images/course.jpg");padding:30px;background-size: 100% 100%;} -/*background: linear-gradient(to right, rgb(69, 191, 165) 0%, rgb(164, 175, 247) 100%);background-color:rgb(160, 175, 247);*/ +/*background: linear-gradient(to right, rgb(104, 177, 215) 0%, rgb(1,75,79) 100%);*/ +/*background: linear-gradient(to right,#5DDAE4,#23ADC9);*/ +.task-index-head-top{ padding:30px;background: -moz-linear-gradient(to right bottom, #5DDAE4, #9E87DA);} +.task-index-head-top-course{padding:30px;background: linear-gradient(to right, rgb(69, 191, 165) 0%, rgb(164, 175, 247) 100%);} .task-inde-head-title{ color:#fff; } .task-index-head-info{ background:#fff; padding:10px 30px;} From 5b6156ff4c2bcca10eb9e6276d9752541d5cee5b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 25 Aug 2017 11:19:57 +0800 Subject: [PATCH 13/22] =?UTF-8?q?editormd=E5=BC=80=E5=90=AFHTML=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/mini_profiler.rb | 2 +- public/editormd/editormd.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/mini_profiler.rb b/config/initializers/mini_profiler.rb index 2ef3ae5f0..ecd0fc45c 100644 --- a/config/initializers/mini_profiler.rb +++ b/config/initializers/mini_profiler.rb @@ -1,4 +1,4 @@ if Rails.env.development? Rack::MiniProfiler.config.position = 'right' - Rack::MiniProfiler.config.start_hidden = false + Rack::MiniProfiler.config.start_hidden = true end \ No newline at end of file diff --git a/public/editormd/editormd.js b/public/editormd/editormd.js index 18ebd0bd3..7589cedfe 100644 --- a/public/editormd/editormd.js +++ b/public/editormd/editormd.js @@ -157,7 +157,7 @@ tocDropdown : false, tocContainer : "", tocStartLevel : 1, // Said from H1 to create ToC - htmlDecode : false, // Open the HTML tag identification + htmlDecode : "style,iframe|on*", // Open the HTML tag identification pageBreak : true, // Enable parse page break [========] atLink : true, // for @link emailLink : true, // for email address auto link From d854c7aa5be67e66fb86eb561d92fbb940bf33aa Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 25 Aug 2017 14:35:37 +0800 Subject: [PATCH 14/22] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/_subject_top.html.erb | 2 +- app/views/subjects/show.html.erb | 60 ++++++++++++++++-------- public/stylesheets/css/edu-common.css | 2 +- public/stylesheets/css/edu-subject.css | 9 ++-- public/stylesheets/css/taskstyle.css | 7 +-- 5 files changed, 52 insertions(+), 28 deletions(-) diff --git a/app/views/subjects/_subject_top.html.erb b/app/views/subjects/_subject_top.html.erb index 597ba93b9..c43ec882c 100644 --- a/app/views/subjects/_subject_top.html.erb +++ b/app/views/subjects/_subject_top.html.erb @@ -2,7 +2,7 @@

      <%= @subject.name %> <% if User.current.manager_of_subject?(@subject) %> - + <% end %>

      diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb index 25332ef71..384b0bbb4 100644 --- a/app/views/subjects/show.html.erb +++ b/app/views/subjects/show.html.erb @@ -4,7 +4,7 @@

      <% if User.current.manager_of_subject?(@subject) %> - + <% end %>

      @@ -17,12 +17,12 @@ <% count = 0 %> <% @stages.each_with_index do |stage, index| %>
      -

      +

      第<%= index + 1 %>章  <%= stage.name %> <% if @subject.status == 0 && User.current.manager_of_subject?(@subject) %> - - + + <% else %> <% end %> @@ -34,27 +34,27 @@

    • - <%= shixun.name %> + 1-1  <%= shixun.name %>
    • -
    • +
    • <% if @subject.status < 2 %> - <%= shixun.shixun_status %> + <%= shixun.shixun_status %> <% else %> <% case my_shixun_status(shixun, User.current) %> <% when '已通关' %> - 已通关   + 已通关   <% when '未通关' %> - 未通关   + 未通关   <% when '未开启' %> - 未开启   + 未开启   <% end %> <% end %> <% if shixun.status > 1 %> <% myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => shixun.id).first %> <% if myshixun.blank? %> - <%= link_to "开始实战", operation_shixun_path(shixun, :myshixun_id => myshixun.try(:id)), :class => "task-btn task-btn-orange", :id => "shixun_operation", :remote => true %> + <%= link_to "开始实战", operation_shixun_path(shixun, :myshixun_id => myshixun.try(:id)), :class => "task-btn task-btn-orange ", :style=>"display: none", :id => "shixun_operation", :remote => true %> <% else %> - <%= link_to "继续实战", operation_shixun_path(shixun, :myshixun_id => myshixun.try(:id)), :class => "task-btn task-btn-orange", :id => "shixun_operation", :remote => true %> + <%= link_to "继续实战", operation_shixun_path(shixun, :myshixun_id => myshixun.try(:id)), :class => "task-btn task-btn-orange", :style=>"display: none", :id => "shixun_operation", :remote => true %> <% end %> <% end %>
    • @@ -111,22 +111,20 @@

      学习须知 <% if User.current.manager_of_subject?(@subject) %> - + <% end %>

      <%= @subject.learning_notes.blank? ? "暂未填写" : @subject.learning_notes %>

      -

      教学名师

      -
      +

      教学名师

      +

      <%= image_tag(url_to_avatar(@subject.user), :width =>"40", :height => "40", :class => "bor-radius-all", :alt=>"头像") %>

      <%= @subject.user.try(:show_name) %>

      <%= @subject.user.school_name + @subject.user.identity %>

      -

      <%= @subject.user.user_extensions.brief_introduction.blank? ? "暂未填写" : @subject.user.user_extensions.brief_introduction %>

      - +

      <%= @subject.user.user_extensions.brief_introduction.blank? ? "暂未填写" : @subject.user.user_extensions.brief_introduction %>

      +
      \ No newline at end of file diff --git a/public/javascripts/edu/shixun.js b/public/javascripts/edu/shixun.js index 459901f88..e899e02cf 100644 --- a/public/javascripts/edu/shixun.js +++ b/public/javascripts/edu/shixun.js @@ -1,9 +1,3 @@ -$(function() { - $("#search_not_collaborators").on('input', function (e) { - throttle(search_not_teacher_f, window, e); - }); -}); - var lastteSearchCondition = ''; function search_not_teacher_f(e){ console.log($(e.target).val().trim()); From 20b509a985178433637ac45a1d708632367e4aca Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 25 Aug 2017 15:50:00 +0800 Subject: [PATCH 18/22] =?UTF-8?q?=E9=95=9C=E5=83=8F=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=9A=84=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 39 ++++++++-- app/models/mirror_repository.rb | 3 +- app/views/layouts/base_management.html.erb | 2 +- .../managements/_modify_mirror_modal.html.erb | 14 ++-- app/views/managements/delete_mirror.js.erb | 9 +++ .../managements/mirror_repository.html.erb | 74 +++++++------------ config/routes.rb | 1 + 7 files changed, 79 insertions(+), 63 deletions(-) create mode 100644 app/views/managements/delete_mirror.js.erb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index a87ed2ae8..d52300759 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -15,14 +15,18 @@ class ManagementsController < ApplicationController mirror_rep = Redmine::Configuration['mirror_rep'] uri = "#{mirror_rep}/images/json" uri = URI.parse(URI.encode(uri.strip)) - res = Net::HTTP.get(uri) - res = JSON.parse(res) - res.each do |mirror| - mirrorID = mirror['Id'][7, 12] - if MirrorRepository.where(:mirrorID => mirrorID).count == 0 - + begin + res = Net::HTTP.get(uri) + res = JSON.parse(res) + res.each do |mirror| + mirrorID = mirror['Id'][7, 12] + if MirrorRepository.where(:mirrorID => mirrorID).count == 0 + MirrorRepository.create(:mirrorID => mirrorID, :status => 0, :created_at => Time.at(mirror['Created']), :updated_at => Time.at(mirror['Created'])) + end end + rescue end + @mirrors = MirrorRepository.where("0=0").reorder("updated_at desc") end def add_mirror_type @@ -41,7 +45,7 @@ class ManagementsController < ApplicationController end def modify_mirror - @mirror = MirrorRepository.find_by_mirrorID params[:mirrorID] + @mirror = MirrorRepository.find params[:mirror_id] @mirror_types = MirrorType.where("0=0") end @@ -91,6 +95,27 @@ class ManagementsController < ApplicationController render :json => data end + def delete_mirror + mirror = MirrorRepository.find params[:mirror_id] + mirror_rep = Redmine::Configuration['mirror_rep'] + uri = "#{mirror_rep}/images/" + mirror.mirrorID.to_s + uri = URI.parse(URI.encode(uri.strip)) + data = {name:mirror.mirrorID.to_s} + http = Net::HTTP.new uri.host, uri.port + begin + req = Net::HTTP::Delete.new(uri.request_uri) + req.form_data = data + res= http.start { |http| http.request req } + if res.code == '200' + @status = 1 + mirror.destroy + else + @status = 0 + end + rescue =>err + end + end + # 专业列表 def profession @syllabus=Syllabus.where("0=0") diff --git a/app/models/mirror_repository.rb b/app/models/mirror_repository.rb index 5a6525b41..bf92b0c08 100644 --- a/app/models/mirror_repository.rb +++ b/app/models/mirror_repository.rb @@ -1,5 +1,6 @@ class MirrorRepository < ActiveRecord::Base has_many :mirror_update_records, :dependent => :destroy has_many :mirror_repository_types, :dependent => :destroy - attr_accessible :description, :mirrorID, :name, :status, :tag, :main_type + # status: 0 未发布 1 已发布 + attr_accessible :description, :mirrorID, :name, :status, :tag, :main_type, :created_at, :updated_at end diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index 5adbee8f3..ce384a80c 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -63,7 +63,7 @@
    • <%= link_to "实训列表", shixuns_managements_path %>
    • <%= link_to "已发布的实训", publish_shixuns_managements_path %>
    • <%= link_to "已关闭的实训", close_shixuns_managements_path %>
    • -
    • <%= link_to "镜像管理", mirror_repository_managements_path %>
    • +
  • 实训课程+ diff --git a/app/views/managements/_modify_mirror_modal.html.erb b/app/views/managements/_modify_mirror_modal.html.erb index 74eb14647..c7433b503 100644 --- a/app/views/managements/_modify_mirror_modal.html.erb +++ b/app/views/managements/_modify_mirror_modal.html.erb @@ -7,13 +7,13 @@
    - - + +
    - +
    @@ -23,23 +23,23 @@
    - +
    小类别不能为空
    - +
    - + name="status" value="0" id="status_0" class="ml-3 mr5 magic-radio"> - + name="status" value="1" id="status_1" class="ml-3 mr5 magic-radio">
    diff --git a/app/views/managements/delete_mirror.js.erb b/app/views/managements/delete_mirror.js.erb new file mode 100644 index 000000000..e7cbecad6 --- /dev/null +++ b/app/views/managements/delete_mirror.js.erb @@ -0,0 +1,9 @@ +<% if @status == 1 %> +$("#mirror_rep_<%= params[:mirror_id] %>").nextAll().each(function(){ + $(this).children(":first").html(parseInt($(this).children(":first").html()) - 1); +}); +$("#mirror_rep_<%= params[:mirror_id] %>").remove(); +notice_box("删除成功"); +<% else %> + notice_box("删除失败"); +<% end %> \ No newline at end of file diff --git a/app/views/managements/mirror_repository.html.erb b/app/views/managements/mirror_repository.html.erb index 2b6c6070e..3c1b241ff 100644 --- a/app/views/managements/mirror_repository.html.erb +++ b/app/views/managements/mirror_repository.html.erb @@ -13,7 +13,7 @@
  • -
    +
    @@ -27,52 +27,32 @@ - - - - - - - - - - - - - - - - - - - - - - + <% if @mirrors.count > 0 %> + <% @mirrors.each_with_index do |mirror, index| %> + + + + + + + + + + + + <% end %> + <% else %> + <%= render :partial => "welcome/no_data" %> + <% end %>
    序号操作
    1drfhuko4java1.8-jfinal5.0 -

    java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;

    - - - -
    -

    docert1.5;centos2.5;

    - -
    镜像是。。。。未发布2017-08-15 10:34 - 删除 - <%= link_to '修改', modify_mirror_managements_path(:mirrorID => '1232423'), :class => "color-blue update_table_date", :remote => true %> - 保存 -
    2edftg3grpython3.6-mysql1.5 -

    java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;java1.8;jfinal5.0;

    - - - -
    -

    docert1.5;centos2.5;

    - - -
    镜像是。。。。已发布2017-08-15 10:34 - 修改 - 保存 -
    <%= index + 1 %><%= mirror.mirrorID %><%= mirror.name %> +

    <%= mirror.main_type %>

    +
    +

    <%= mirror.tag %>

    +
    <%= mirror.description %><%= mirror.status == 0 ? "未发布" : "已发布" %><%= format_time mirror.updated_at %> + <% if mirror.status == 0 %> + 删除 + <% end %> + <%= link_to '修改', modify_mirror_managements_path(:mirror_id => mirror.id), :class => "color-blue update_table_date", :remote => true %> +
    diff --git a/config/routes.rb b/config/routes.rb index a0dd65ce3..5e462a3de 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -169,6 +169,7 @@ RedmineApp::Application.routes.draw do get 'modify_mirror' post 'search_mirror_type' post 'update_mirror' + delete 'delete_mirror' match 'applicable_course',:via=>[:get,:post] match 'profession',:via=>[:get,:post] match 'shixuns', :via => [:get, :post] From b08d4da7f975a248157bbb44c4bfa751e6b94b18 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 25 Aug 2017 15:55:23 +0800 Subject: [PATCH 19/22] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=8D=E5=A4=9F1=E9=A1=B5=E7=9A=84?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_homework_index_list.html.erb | 34 ++++++++++--------- public/javascripts/edu/application.js | 2 +- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app/views/homework_common/_homework_index_list.html.erb b/app/views/homework_common/_homework_index_list.html.erb index 12f82afc0..a3f23d783 100644 --- a/app/views/homework_common/_homework_index_list.html.erb +++ b/app/views/homework_common/_homework_index_list.html.erb @@ -63,13 +63,13 @@
  • <%= link_to "导出成绩", student_work_index_path(:homework => homework_common, :format => 'xls'), :id => "export_student_work" %>
  • <% if homework_common.homework_type == 1 || homework_common.homework_type == 3 %> -
  • - <% if homework_common.student_works.has_committed.empty?%> - 导出作品附件 - <% else%> - <%= link_to "导出作品附件", zipdown_assort_path(obj_class: homework_common.class,obj_id: homework_common, format: :json), remote: true, :class => "download_homework_attachments" %> - <% end%> -
  • +
  • + <% if homework_common.student_works.has_committed.empty?%> + 导出作品附件 + <% else%> + <%= link_to "导出作品附件", zipdown_assort_path(obj_class: homework_common.class,obj_id: homework_common, format: :json), remote: true, :class => "download_homework_attachments" %> + <% end%> +
  • <% end %> <% unless homework_common.is_public %>
  • @@ -99,16 +99,18 @@ <% end %>
  • <% end %> -
    -
    -
      - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %> -
    -
    -
    -
    + <% if @obj_count > 20 %> +
    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %> +
    +
    +
    +
    + <% end %> <% else %>
    - <%= render :partial => "welcome/no_data" %> + <%= render :partial => "welcome/no_data" %>
    <% end %> diff --git a/public/javascripts/edu/application.js b/public/javascripts/edu/application.js index 7435a10bb..453533a4d 100644 --- a/public/javascripts/edu/application.js +++ b/public/javascripts/edu/application.js @@ -136,7 +136,7 @@ $(function(){ }).hide(); }); //下拉框 - $("[select-for]").append(""); + $("[select-for]").append(""); $("[select-for]").hover(function(){ $(this).find(".down-select").show(); },function(){ From 1939ddb9b7de67ebc0b6493f91d5c68d35be3e56 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 25 Aug 2017 16:11:11 +0800 Subject: [PATCH 20/22] =?UTF-8?q?TMP=E7=89=88=E6=9C=AC=E5=BA=93=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0tip=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/shixun_show.html.erb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/repositories/shixun_show.html.erb b/app/views/repositories/shixun_show.html.erb index b76b07421..f5a2e19b3 100644 --- a/app/views/repositories/shixun_show.html.erb +++ b/app/views/repositories/shixun_show.html.erb @@ -1,4 +1,11 @@ -
    +
    +
    • From 5bd3e4a1857dda8c2552e6f8e9f030682352c872 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 25 Aug 2017 16:11:21 +0800 Subject: [PATCH 21/22] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 4 +- app/views/subjects/_subject_list.html.erb | 81 +---------------------- app/views/subjects/edit.html.erb | 16 +++-- app/views/subjects/new.html.erb | 16 +++-- app/views/subjects/show.html.erb | 27 ++++++-- public/javascripts/edu/base_edu.js | 12 ++-- 6 files changed, 47 insertions(+), 109 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 41ea375e2..f0b27b76b 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -37,7 +37,7 @@ class SubjectsController < ApplicationController def create if params[:subject] - subject = Subject.create(:name => params[:subject][:name], :learning_notes => params[:subject][:learning_notes], :introduction => params[:subject][:introduction], :description => params[:subject][:description], :user_id => User.current.id, :visits => 0, :status => 0) + subject = Subject.create(:name => params[:subject][:name], :learning_notes => params[:subject][:learning_notes], :description => params[:subject][:description], :user_id => User.current.id, :visits => 0, :status => 0) end redirect_to subject_path(subject) end @@ -48,7 +48,7 @@ class SubjectsController < ApplicationController def update if params[:subject] - subject = @subject.update_attributes(:name => params[:subject][:name], :learning_notes => params[:subject][:learning_notes], :introduction => params[:subject][:introduction], :description => params[:subject][:description]) + subject = @subject.update_attributes(:name => params[:subject][:name], :learning_notes => params[:subject][:learning_notes], :description => params[:subject][:description]) end redirect_to subject_path(@subject) end diff --git a/app/views/subjects/_subject_list.html.erb b/app/views/subjects/_subject_list.html.erb index f2e2641b4..0d8599214 100644 --- a/app/views/subjects/_subject_list.html.erb +++ b/app/views/subjects/_subject_list.html.erb @@ -14,51 +14,6 @@
    <% else %> <% @subjects.each do |subject| %> -
    <% if subject.status < 2 && !User.current.manager_of_subject?(subject) %> @@ -72,7 +27,7 @@ <%= subject.name %>

    - <%= subject.introduction.blank? ? "轻松学习#{subject.name}~" : subject.introduction %> + <%= subject.description.blank? ? "轻松学习#{subject.name}~" : subject.description %>

    <%= subject.stages.count %> @@ -95,40 +50,6 @@ <% end %> <% end %>

    - - <% if @subjects_count > 16 %>
    diff --git a/app/views/subjects/edit.html.erb b/app/views/subjects/edit.html.erb index e98e98f58..5786537f0 100644 --- a/app/views/subjects/edit.html.erb +++ b/app/views/subjects/edit.html.erb @@ -15,11 +15,17 @@
    请输入名称 + + + + + +
  • - - + +
    - 请输入描述 + 请输入简介
  • @@ -27,10 +33,6 @@
    请输入学习须知
  • -
  • - - -
  • <%= link_to "取消", subject_path(@subject), :class => "task-btn fl mr10 ml20" %> diff --git a/app/views/subjects/new.html.erb b/app/views/subjects/new.html.erb index e38f0c6ef..0e7bd2b09 100644 --- a/app/views/subjects/new.html.erb +++ b/app/views/subjects/new.html.erb @@ -15,11 +15,17 @@
    请输入名称
  • + + + + + +
  • - - + +
    - 请输入描述 + 请输入简介
  • @@ -27,10 +33,6 @@
    请输入学习须知
  • -
  • - - -
  • <% count = 0 %> - <% @stages.each_with_index do |stage, index| %> + <% @stages.each_with_index do |stage, s_index| %>

    - 第<%= index + 1 %>章  <%= stage.name %> + 第<%= s_index + 1 %>章  <%= stage.name %> <% if @subject.status == 0 && User.current.manager_of_subject?(@subject) %> @@ -34,7 +34,7 @@

  • - 1-1  <%= shixun.name %> + <%= s_index + 1 %>-<%= index + 1 %>  <%= shixun.name %>
  • <% if @subject.status < 2 %> @@ -117,14 +117,19 @@

    <%= @subject.learning_notes.blank? ? "暂未填写" : @subject.learning_notes %>

  • -

    教学名师

    +

    教学名师 + <% if User.current == @subject.user %> + + <% end %> +

    <%= image_tag(url_to_avatar(@subject.user), :width =>"40", :height => "40", :class => "bor-radius-all", :alt=>"头像") %>

    <%= @subject.user.try(:show_name) %>

    <%= @subject.user.school_name + @subject.user.identity %>

    <%= @subject.user.user_extensions.brief_introduction.blank? ? "暂未填写" : @subject.user.user_extensions.brief_introduction %>

    - + +
    \ No newline at end of file diff --git a/app/views/managements/_profession_list.html.erb b/app/views/managements/_profession_list.html.erb index 4fe73edcc..4b5ad683f 100644 --- a/app/views/managements/_profession_list.html.erb +++ b/app/views/managements/_profession_list.html.erb @@ -11,17 +11,17 @@ - <% @syllabus.each do |syllabus| %> + <% @major.each do |major| %> - <%= syllabus.id %> - <%= syllabus.syllabus_major_level == '' ? "--" : syllabus.syllabus_major_level %> - <%= syllabus.syllabus_discipline_category == '' ? "--" : syllabus.syllabus_discipline_category %> - <%= syllabus.syllabus_first_level_discipline == "" ? "--" : syllabus.syllabus_first_level_discipline %> - <%= syllabus.syllabus_major == "" ? "--" : syllabus.syllabus_major %> - <%= format_time syllabus.created_at %> + <%= major.id %> + <%= major.major_major_level %> + <%= major.major_discipline_category %> + <%= major.major_first_level_discipline %> + <%= major.name %> + <%= format_time major.created_at %> - class="mr5 magic-checkbox" id="join_course_role_<%= syllabus.id%>"> - + class="mr5 magic-checkbox" id="join_course_role_<%= major.id%>"> + <% end %> @@ -31,7 +31,7 @@
      - <%= pagination_links_full @syllabus_pages, @syllabus_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> + <%= pagination_links_full @major_pages, @major_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
    diff --git a/app/views/managements/depart.html.erb b/app/views/managements/depart.html.erb index 19dad429f..e7c8832c9 100644 --- a/app/views/managements/depart.html.erb +++ b/app/views/managements/depart.html.erb @@ -12,6 +12,6 @@ diff --git a/app/views/managements/new_major.js.erb b/app/views/managements/new_major.js.erb new file mode 100644 index 000000000..387266021 --- /dev/null +++ b/app/views/managements/new_major.js.erb @@ -0,0 +1,2 @@ +var htmlvalue = " <%= escape_javascript( render :partial => 'managements/new_major') %>"; +pop_box_new(htmlvalue, 450, 420); \ No newline at end of file diff --git a/app/views/managements/profession.html.erb b/app/views/managements/profession.html.erb index d7dae411d..c3b558984 100644 --- a/app/views/managements/profession.html.erb +++ b/app/views/managements/profession.html.erb @@ -1,11 +1,11 @@ <%= form_tag(url_for(profession_managements_path),:id=>"profession",:method => "post",:remote=>true) do %>
    - <%= select_tag :major_level,options_for_select(major_level_option, 0), {:id=>"major_level", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 10px 0px 25px;"} %> - <%= select_tag :discipline_category_id,options_for_select(discipline_category_option, nil), {:id=>"discipline_category_id", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 30px 0px 50px;"} %> - <%= select_tag :first_level_discipline_id,options_for_select(first_level_discipline_option, nil), {:id=>"first_level_discipline_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %> + <%= select_tag :major_level,options_for_select(major_level_option, 0), {:id=>"major_level_p", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 10px 0px 25px;"} %> + <%= select_tag :discipline_category_id,options_for_select(discipline_category_option, nil), {:id=>"discipline_category_id_p", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 30px 0px 50px;"} %> + <%= select_tag :first_level_discipline_id,options_for_select(first_level_discipline_option, nil), {:id=> "first_level_discipline_id_p", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %> 搜索 清除 - 新增 + <%= link_to '新增',{ :controller => 'managements', :action => 'new_major', }, :remote => true, :class => "task-btn task-btn-green fr mr30" %> @@ -17,15 +17,31 @@
    <%= render :partial => "managements/profession_list" %>
    - \ No newline at end of file diff --git a/app/views/shixuns/_form.html.erb b/app/views/shixuns/_form.html.erb index d8c99a8a8..b5a81bece 100644 --- a/app/views/shixuns/_form.html.erb +++ b/app/views/shixuns/_form.html.erb @@ -43,7 +43,7 @@
    diff --git a/config/routes.rb b/config/routes.rb index 618725247..acc80b3d4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -213,6 +213,8 @@ RedmineApp::Application.routes.draw do match 'approve_applied_departments',:via=>[:get,:post] delete 'delete_applied_departments' delete 'delete_applied_schools' + match 'new_major', :via => [:get, :post] + post 'insert_major' end end # Enable Grack support diff --git a/public/javascripts/edu/base_edu.js b/public/javascripts/edu/base_edu.js index cf57c69d0..78fec84fd 100644 --- a/public/javascripts/edu/base_edu.js +++ b/public/javascripts/edu/base_edu.js @@ -1,5 +1,5 @@ $(function(){ - $("#major_level_option p").bind("click", function(){ + $("#major_level_option p").live("click", function(){ $("#major_level").val($(this).attr("data-major")); $.ajax({ url: '/syllabuses/get_discipline_categories', @@ -28,7 +28,7 @@ $(function(){ }); }); - $("#discipline_category_option").on("click", "p", function(){ + $("#discipline_category_option p").live("click", function(){ $(this).parents().prev("input").val($(this).html().trim()); $(this).parents(".down-select").hide(); $("#discipline_category_id").val($(this).attr("data-discipline-category-id")); @@ -56,7 +56,7 @@ $(function(){ }); }); - $("#first_level_discipline_option").on("click", "p", function(){ + $("#first_level_discipline_option p").live("click", function(){ $(this).parents().prev("input").val($(this).html().trim()); $(this).parents(".down-select").hide(); $("#first_level_discipline_id").val($(this).attr("data-first-level-discipline-id")); @@ -81,7 +81,7 @@ $(function(){ }); }); - $("#syllabus_major_option").on("click", "p", function(){ + $("#syllabus_major_option p").live("click", function(){ $(this).parents().prev("input").val($(this).html().trim()); $(this).parents(".down-select").hide(); $("#major_id").val($(this).attr("data-major_id")); @@ -90,7 +90,7 @@ $(function(){ } }); - $("#syllabus_type_option p").bind("click", function(){ + $("#syllabus_type_option p").live("click", function(){ $("#syllabus_type").val($(this).attr("data-syllabus-type")); })