diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 5ad869462..b11b5d174 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -2,13 +2,16 @@ class ChallengesController < ApplicationController layout "base_shixun" before_filter :check_authentication - before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation] - before_filter :find_challenge, :only => [:show, :edit, :update, :challenge_build, :index_up, :index_down, :destroy, :update_evaluation] + before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build, :update_evaluation, :add_choose_question, :new_choose_question, :choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose] + before_filter :find_challenge, :only => [:show, :edit, :update, :challenge_build, :index_up, :index_down, :destroy, :update_evaluation, :add_choose_question, :new_choose_question, :choose_type_show, :edit_choose_question, :update_choose_question, :destroy_challenge_choose] before_filter :build_challege_from_params, :only => [:new, :create] before_filter :tpi_manager_allowed, :only => [:challenge_build, :destroy, :edit, :new, :create] before_filter :allowed_view, :only => [:show] before_filter :query_challeges, :only => [:show, :edit, :update, :update_evaluation] before_filter :find_shixun_language, :only => [:show, :new, :edit] + #before_filter :default_format_js, only: :new_or_edit_choose_question + + #skip_before_filter :verify_authenticity_token, :only => [:new_or_edit_choose_question] include ApplicationHelper @@ -30,6 +33,8 @@ class ChallengesController < ApplicationController @challenge.shixun = @shixun @challenge.user = User.current @challenge.st = params[:st].to_i + @challenge.save! +=begin if @challenge.save! if params[:st].to_i != 0 #创建选项 @@ -39,6 +44,7 @@ class ChallengesController < ApplicationController end end end +=end # 实训是否需要重启 # 非实践任务创建第一个阶段时调用 publishGame, 避免不包含实践任务的实训进行模拟实战时报错 if @challenge.position == 1 && params[:st].to_i != 0 @@ -91,9 +97,117 @@ class ChallengesController < ApplicationController if challenge_pos < challenge_num @next_challenge = Challenge.where(:shixun_id => @shixun, :position => challenge_pos+1).first end - @prev_challenge = Challenge.where(:shixun_id => @shixun, :position => challenge_pos - 1).first if challenge_pos - 1 > 0 + @prev_challenge = Challenge.where(:shixun_id => @shixun, :position => challenge_pos - 1).first if (challenge_pos - 1) > 0 @tab = params[:tab].blank? ? 1 : params[:tab].to_i @editor = params[:editor] # 编辑模式 + respond_to do |format| + format.html + format.js + end + end + + def new_choose_question + ActiveRecord::Base.transaction do + begin + @challenge_choose = ChallengeChoose.new + @challenge_choose.challenge_id = @challenge.id + @challenge_choose.subject = params[:choose][:subject] + @challenge_choose.answer = params[:choose][:answer] + @challenge_choose.standard_answer = params[:standard_answer] + @challenge_choose.score = params[:challenge][:score].to_i + @challenge_choose.difficult = params[:challenge][:difficulty].to_i + @challenge_choose.position = params[:position].to_i + @challenge_choose.category = params[:category].to_i + if @challenge_choose.save! + # 创建选项 + params[:question][:cnt].each_with_index do |test, index| + answer = params[:choice][:answer][index] == "0" ? false : true + ChallengeQuestion.create(:option_name => test, :challenge_choose_id => @challenge_choose.id, :position => index, :right_key => answer) + end + # 创建单选多选的技能标签 + unless params[:knowledge].blank? + params[:knowledge][:input].each do |input| + ChallengeTag.create(:name => input, :challenge_choose_id => @challenge_choose.id, :challenge_id => @challenge.id) + end + end + end + @index = params[:position].to_i - 1 + respond_to do |format| + format.js + end + rescue Exception => e + flash[:error] = "#{e.message}" + redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun) + raise ActiveRecord::Rollback + end + end + end + + def update_choose_question + @challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first + ActiveRecord::Base.transaction do + @challenge_choose.update_attributes(:subject => params[:choose][:subject], + :answer => params[:choose][:answer], + :standard_answer => params[:standard_answer], + :score => params[:challenge][:score].to_i, + :difficult => params[:challenge][:difficulty].to_i) + begin + @challenge_choose.challenge_questions.delete_all + params[:question][:cnt].each_with_index do |test, index| + answer = params[:choice][:answer][index] == "0" ? false : true + ChallengeQuestion.create(:option_name => test, :challenge_choose_id => @challenge_choose.id, :position => index, :right_key => answer) + end + @challenge_choose.challenge_tags.delete_all unless @challenge_choose.challenge_tags.blank? + unless params[:knowledge].blank? + params[:knowledge][:input].each do |input| + ChallengeTag.create(:name => input, :challenge_choose_id => @challenge_choose.id, :challenge_id => @challenge.id) + end + end + @challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first + @index = params[:index].to_i + respond_to do |format| + format.js + end + rescue Exception => e + flash[:error] = "#{e.message}" + format.html{redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun)} + raise ActiveRecord::Rollback + end + end + end + + def edit_choose_question + @challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first + @category = @challenge_choose.category + @position = @challenge_choose.position.to_i + @index = params[:index].to_i + respond_to do |format| + format.js + end + end + + def choose_type_show + @challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first + @index = params[:index].to_i + respond_to do |format| + format.js + end + end + + def destroy_challenge_choose + @challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first + @challenge_choose.destroy + + redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun) + end + + def add_choose_question + @category = params[:category].to_i + @position = params[:position] + #@challenge_choose = @challenge.challenge_chooses + respond_to do |format| + format.js + end end def destroy @@ -108,22 +222,22 @@ class ChallengesController < ApplicationController def update ActiveRecord::Base.transaction do @challenge.update_attributes(params[:challenge]) - if (params[:tab] == "1" || params[:tab].nil?) && @challenge.st != 0 - begin - @challenge.challenge_questions.delete_all - params[:question][:cnt].each_with_index do |test, index| - answer = params[:choice][:answer][index] == "0" ? false : true - ChallengeQuestion.create(:option_name => test, :challenge_id => @challenge.id, :position => index, :right_key => answer) - end - redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => params[:tab]) - rescue Exception => e - flash[:error] = "#{e.message}" - format.html{redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun)} - raise ActiveRecord::Rollback - end - else + #if (params[:tab] == "1" || params[:tab].nil?) && @challenge.st != 0 + # begin + # @challenge.challenge_questions.delete_all + # params[:question][:cnt].each_with_index do |test, index| + # answer = params[:choice][:answer][index] == "0" ? false : true + # ChallengeQuestion.create(:option_name => test, :challenge_id => @challenge.id, :position => index, :right_key => answer) + # end + # redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => params[:tab]) + # rescue Exception => e + # flash[:error] = "#{e.message}" + # format.html{redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun)} + # raise ActiveRecord::Rollback + # end + #else redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => params[:tab]) - end + #end end end @@ -272,4 +386,8 @@ class ChallengesController < ApplicationController @language = language_switch language end + def default_format_js + response.headers['content--type'] = 'text/javascript' + request.format = 'js' + end end diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index cbae9d708..0c011a047 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -49,7 +49,7 @@ class GamesController < ApplicationController @type = params[:type] challenge_path = @game_challenge.path # 用户选项 - @user_answer = @game.outputs.first.actual_output.split("") unless @st == 0 || @game.outputs.blank? + #@user_answer = @game.outputs.first.actual_output.split("") unless @st == 0 || @game.outputs.blank? # 默认打开文件 logger.info("repository id is #{@repository.try(:id)}, repository's shixun_id =#{@repository.try(:myshixun_id)} shixun_id =#{@repository.try(:shixun_id)}, project_id => #{@repository.try(:project_id)}") # 验证challenge文件名的合法性 @@ -300,53 +300,42 @@ class GamesController < ApplicationController end # 选择题评测(选择题不需要重新评测) + # score 获得金币数 tag_count 技能数 right用户是否全对 answer_right全部选择题的正确性 def evaluating_choice @game_challenge = @game.challenge - user_answer = params[:answer] - correct = true + @challenges = Challenge.where(:shixun_id => @myshixun.shixun_id) + @shixun = @myshixun.shixun score = 0 tag_count = 0 - if !user_answer.blank? - if user_answer.split("").count != @game_challenge.challenge_questions.where(:right_key => true).count - correct = false - else - user_answer.split("").each do |answer| - question = @game_challenge.challenge_questions.where(:position => answer.to_i).first - unless question.right_key - correct = false - break - end - end + @right = true + answer_right = [] + @game_challenge.challenge_chooses.each_with_index do |choose, index| + correct = (params[:answer][index] == choose.standard_answer) ? true : false + if choose.choose_outputs.blank? + ChooseOutputs.create(:challenge_choose_id => choose.id, :user_id => User.current.id, :answer => params[:answer][index], :correct => correct) end - else - correct = false + if @shixun.status > 1 && !@game.answer_open + if correct + score += choose.score + tag_count += choose.challenge_tags.count + end + elsif @shixun.status > 1 && @game.answer_open + score -= choose.score + end + unless correct + @right = false + end + answer_right << correct end @game.update_attributes(:status => 2, :end_time => Time.now) - had_done = @game.had_done - shixun = @myshixun.shixun - if shixun.status > 1 && !@game.answer_open - if correct - #User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score)) - reward_grade(@game.user, @game.id, 'Game', @game_challenge.score) - reward_experience(@game.user, @game.id, 'Game', @game_challenge.score) - @game.update_attribute(:final_score, @game_challenge.score) - score = @game_challenge.score - tag_count = @game_challenge.challenge_tags.count - else - score = "+0" - tag_count = 0 - end - elsif shixun.status > 1 && @game.answer_open - score = -@game_challenge.score.to_i - tag_count = 0 - else - score = "+0" - tag_count = 0 + @had_done = @game.had_done + reward_grade(@game.user, @game.id, 'Game', score) + reward_experience(@game.user, @game.id, 'Game', score) + @game.update_attribute(:final_score, score) + + respond_to do |format| + format.js{redirect_to myshixun_game_path(@game, :myshixun_id => @myshixun, :choose => 1)} end - if @game.outputs.blank? - Output.create(:game_id => @game.id, :actual_output => user_answer, :result => correct) - end - render :json => {correct: correct, had_done: had_done, :grade => User.where(:id => User.current.id).first.grade, score: score, tag_count: tag_count, position: @game_challenge.position} end @@ -407,9 +396,19 @@ class GamesController < ApplicationController def answer challenge = @game.challenge @challenge_score = challenge.score.to_i + @answer = "" # 已经开启过 @score = User.current.grade.to_i - @challenge_score - @answer = challenge.answer + if(params[:choose] == "true") + challenge.challenge_chooses.each_with_index do |choose, index| + @answer += "第"+ ((index + 1).to_s) +"题:
" + @answer += choose.answer + @answer += "


" + end + else + @answer = challenge.answer + end + if challenge.shixun.status < 2 || @game.answer_open @viewed = 1 else diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 4019e1110..b94f6fb8f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -251,7 +251,7 @@ class HomeworkCommonController < ApplicationController @homework_detail_programing.ta_proportion = 0 if @homework_detail_programing end if @homework_detail_manual.comment_status < 4 - if params[:homework_anonymous_appeal] + if params[:homework_anonymous_comment] && params[:homework_anonymous_appeal] @homework.anonymous_appeal = 1 @homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time] @homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty] @@ -338,7 +338,6 @@ class HomeworkCommonController < ApplicationController if @homework.end_time < Time.now @homework.student_works.each do |student_work| set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation - student_work.save end end end diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 1a7906775..f3191d99b 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -700,7 +700,7 @@ end @courses = @courses.where(:homepage_show => params[:homepage_show].to_i) end - if params[:course_list]&& params[:course_list]!='' + if params[:course_list] && params[:course_list] != '' @courses = @courses.where(:course_list_id => courselist) end @@ -826,6 +826,18 @@ end end end + # 导出excel + def export_excel + @course = params[:course] + respond_to do |format| + format.xls { + @course = @course.reorder("#{Tracker.table_name}.position, #{Course.table_name}.id").all + filename = "#{l(:label_course_list_xls)}.xls" + send_data(course_list_xls(@course), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } + end + end + # 0 全部;1 活动的; 2 已注册; 3 锁定 def users @menu_type @@ -1076,16 +1088,16 @@ end user_id = s_user_id & d_user_id & apply_user_id if params[:research_condition] == "name" - @users = User.where(:id => user_id).where("concat(lastname, firstname) like '%#{params[:research_contents]}%'").order("created_on desc") + @users = User.where(:id => user_id).where("concat(lastname, firstname) like '%#{params[:research_contents]}%'").order("last_login_on desc") elsif params[:research_condition] == "email" - @users = User.where(:id => user_id).where("mail like '%#{params[:research_contents]}%'").order("created_on desc") + @users = User.where(:id => user_id).where("mail like '%#{params[:research_contents]}%'").order("last_login_on desc") elsif params[:research_condition] == "phone" - @users = User.where(:id => user_id).where("phone like '%#{params[:research_contents]}%'").order("created_on desc") + @users = User.where(:id => user_id).where("phone like '%#{params[:research_contents]}%'").order("last_login_on desc") elsif params[:research_condition] == "nickname" if params[:research_contents].blank? - @users = User.where(:id => user_id).order("created_on desc") + @users = User.where(:id => user_id).order("last_login_on desc") else - @users = User.where(:id => user_id).where("nickname like '%#{params[:research_contents]}%'").order("created_on desc") + @users = User.where(:id => user_id).where("nickname like '%#{params[:research_contents]}%'").order("last_login_on desc") end end @@ -1367,4 +1379,32 @@ end render_404 end + def course_list_xls course + xls_report = StringIO.new + book = Spreadsheet::Workbook.new + sheet1 = book.create_worksheet :name => "course" + blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 + sheet1.row(0).default_format = blue + sheet1.row(0).concat([l(:issue_xls_id),l(:issue_xls_tracker_id),l(:issue_xls_title),l(:issue_xls_description),l(:issue_xls_status),l(:issue_xls_assign),l(:issue_xls_priority),l(:issue_xls_author),l(:issue_xls_created_at),l(:milestone),l(:issue_xls_start),l(:issue_xls_due),l(:issue_xls_ratio)]) + count_row = 1 + issues.each do |issue| + sheet1[count_row,0] = issue.id + sheet1[count_row,1] = issue_tracker_change(issue.tracker_id) + sheet1[count_row,2] = issue.subject + sheet1[count_row,3] = (issue.description.gsub(/<\/?.*?>/,"")).html_safe + sheet1[count_row,4] = issue_status_change(issue.status_id) + sheet1[count_row,5] = issue.assigned_to.try(:show_name) + sheet1[count_row,6] = issue_priority_change(issue.priority_id) + sheet1[count_row,7] = issue.author.show_name + sheet1[count_row,8] = issue.created_on.nil? ? issue.created_on : issue.created_on.strftime('%Y-%m-%d %H:%M:%S') + sheet1[count_row,9] = issue.fixed_version.try(:name) + sheet1[count_row,10] = issue.start_date.nil? ? issue.start_date : issue.start_date.strftime('%Y-%m-%d') + sheet1[count_row,11] = issue.due_date.nil? ? issue.due_date : issue.due_date.strftime('%Y-%m-%d') + sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id) + count_row += 1 + end + book.write xls_report + xls_report.string + end + end diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index b3d7ad491..46a11ef2e 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -14,6 +14,10 @@ class ShixunsController < ApplicationController CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) + + def statistics_students + + end # push代码的时候会触发gitlab hook def ghook shixun_modify_status_without_publish(@shixun, 1) @@ -562,11 +566,14 @@ class ShixunsController < ApplicationController # end # @shixun.major_id = params[:major_id] @shixun.shixun_major_courses.destroy_all - if CourseList.where(:name => params[:course_list].strip).count > 0 - @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => params[:course_list].strip).first.id) - else - course_list = CourseList.create(:name => params[:course_list].strip, :user_id => User.current.id, :is_admin => 0) - @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id) + course_lists = params[:course_list].strip.split(",") + course_lists.each do |course| + if CourseList.where(:name => course).count > 0 + @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => course.strip).first.id) + else + course_list = CourseList.create(:name => course.strip, :user_id => User.current.id, :is_admin => 0) + @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id) + end end params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0 ActiveRecord::Base.transaction do @@ -686,9 +693,9 @@ class ShixunsController < ApplicationController @user = User.current if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" - @courses = @user.courses.not_deleted_not_end.where("#{Course.table_name}.name like :p",:p=>search).select{|course| @user.allowed_to?(:as_teacher,course)} + @courses = @user.courses.not_deleted_not_end.where("#{Course.table_name}.name like :p",:p=>search).select{|course| @user.has_teacher_role(course)} else - @courses = @user.courses.not_deleted_not_end.select{|course| @user.allowed_to?(:as_teacher,course)} + @courses = @user.courses.not_deleted_not_end.select{|course| @user.has_teacher_role(course)} end @pages = Paginator.new @courses.count, 8, params['page'] || 1 @offset ||= @pages.offset @@ -718,11 +725,11 @@ class ShixunsController < ApplicationController homework_detail_manual.evaluation_num = 0 homework_detail_manual.absence_penalty = 0 homework.homework_detail_manual = homework_detail_manual - if homework.save + if homework.save! homework_detail_manual.save if homework_detail_manual HomeworkCommonsShixuns.create(:homework_common_id => homework.id, :shixun_id => @shixun.id) + redirect_to setting_homework_common_path(homework, :is_new => 1) end - redirect_to setting_homework_common_path(homework, :is_new => 1) end private # REDO: 新增类型copy的时候 diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index a5ed47268..c82cc45ad 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -377,11 +377,11 @@ class StudentWorkController < ApplicationController end #开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 - if (@homework.is_open == 1 && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin? + if (@homework.work_public && 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_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 || @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 未开启匿评 只看到自己的 if @homework.homework_type == 3 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) : [] @@ -389,16 +389,16 @@ class StudentWorkController < ApplicationController @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id) end elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表 - my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first + my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id) @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} - elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 - my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first - if !my_work || my_work.status == 0 - @stundet_works = [] - else - @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 - end + # elsif @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 + # my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first + # if !my_work || my_work.status == 0 + # @stundet_works = [] + # else + # @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 + # end else @stundet_works = [] end @@ -408,11 +408,11 @@ class StudentWorkController < ApplicationController end else - if (@homework.is_open == 1 && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin? + if (@homework.work_public && 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_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 || @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 未开启匿评 只看到自己的 if @homework.homework_type == 3 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) : [] @@ -420,16 +420,16 @@ class StudentWorkController < ApplicationController @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id) end elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表 - my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first + my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id) @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} - elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 - my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first - if !my_work || my_work.status == 0 - @stundet_works = [] - else - @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}") - @show_all = true - end + # elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 + # my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first + # if !my_work || my_work.work_status == 0 + # @stundet_works = [] + # else + # @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}") + # @show_all = true + # end else @stundet_works = [] end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f065461f1..1df371b9b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -283,7 +283,7 @@ module ApplicationHelper if myshixun.nil? 0 else - myshixun.games.select{|game| game.status == 2 && game.answer_open == 0}.count + myshixun.games.select{|game| game.status == 2 && !game.answer_open}.count end end @@ -358,18 +358,23 @@ module ApplicationHelper day = time / 86400 hour = time % (24*60*60) / (60*60) min = time % (24*60*60) % (60*60) / 60 + sec = time % (24*60*60) % (60*60) % 60 if day < 1 if hour < 1 - if time < 1 - time = time == 0 ? "--" : "小于1分钟" + if min < 1 + if sec < 1 + time = "--" + else + time = "#{sec}秒" + end else - time = "#{min} 分钟" + time = "#{min}分钟 #{sec}秒" end else - time = "#{hour}小时 #{min}分" + time = "#{hour}小时 #{min}分钟 #{sec}秒" end else - time = "#{day}天 #{hour}小时 #{min}分" + time = "#{day}天 #{hour}小时 #{min}分钟 #{sec}秒" end return time end @@ -4736,6 +4741,7 @@ end def get_hw_index(hw,is_teacher,type=0) homework_commons = hw.course.homework_commons + Rails.logger.info("----------------------------------------------"+hw.course.to_s) if is_teacher if type != 0 homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc") @@ -4749,7 +4755,8 @@ def get_hw_index(hw,is_teacher,type=0) homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc") end end - hw_ids = homeworks.map{|hw| hw.id} if !homeworks.empty? + Rails.logger.info("----------------------------------------------"+homeworks.count.to_s) + hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank? index = hw_ids.index(hw.id) return index end @@ -5224,9 +5231,9 @@ def set_shixun_final_score homework, student_work, answer_open_evaluation shixun = homework.homework_commons_shixuns.shixun passed_count = answer_open_evaluation ? had_passed_changllenge_num(shixun, student_work.user) : had_passed_no_ans_changllenge_num(shixun, student_work.user) final_score =(passed_count.to_f / shixun.challenges.count) * 100 - student_work.final_score = format("%.2f",final_score.to_f) + student_work.update_column("final_score", format("%.2f",final_score.to_f)) score = student_work.final_score - student_work.late_penalty - student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score + student_work.update_column("work_score", format("%.2f",(score < 0 ? 0 : score).to_f)) if score end end diff --git a/app/models/challenge.rb b/app/models/challenge.rb index dcc50dd43..a9e74f77c 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -1,5 +1,5 @@ #coding=utf-8 -# st 0:实践任务;1:多选任务;2:单选任务 +# st 0:实践任务;1:选择题任务 class Challenge < ActiveRecord::Base default_scope :order => 'position' belongs_to :shixun,:touch=> true @@ -8,7 +8,7 @@ class Challenge < ActiveRecord::Base has_many :test_sets, :dependent => :destroy has_many :challenge_tags, :dependent => :destroy has_many :games, :dependent => :destroy - has_many :challenge_questions, :dependent => :destroy + has_many :challenge_chooses, :dependent => :destroy validates_presence_of :subject # validates_presence_of :score @@ -28,6 +28,35 @@ class Challenge < ActiveRecord::Base str end + def choose_correct_num + num = 0 + self.challenge_chooses.each do |choose| + outputs = ChooseOutputs.where(:challenge_choose_id => choose.id).first + if outputs.nil? + num = nil + else + num += (outputs.correct ? 1 : 0) + end + end + return num + end + + def choose_score + score = 0 + self.challenge_chooses.each do |choose| + score += choose.score + end + return score + end + + def choose_tags_num + num = 0 + self.challenge_chooses.each do |choose| + num += choose.challenge_tags.count + end + return num + end + def next_challenge challenge_count = Challenge.where(:shixun_id => self.shixun_id).count render_404 if self.position ==challenge_count diff --git a/app/models/challenge_choose.rb b/app/models/challenge_choose.rb new file mode 100644 index 000000000..18d76790f --- /dev/null +++ b/app/models/challenge_choose.rb @@ -0,0 +1,13 @@ +class ChallengeChoose < ActiveRecord::Base + # attr_accessible :title, :body + # category 1 单选, 2,多选 + # standard_answer 正确答案 answer: 答题的思路 + default_scope :order => 'position' + belongs_to :challenge + has_many :challenge_tags, :dependent => :destroy + has_many :challenge_questions, :dependent => :destroy + has_one :choose_outputs, :dependent => :destroy + + validates_presence_of :subject + +end diff --git a/app/models/challenge_question.rb b/app/models/challenge_question.rb index eb835c32e..3540330b7 100644 --- a/app/models/challenge_question.rb +++ b/app/models/challenge_question.rb @@ -1,4 +1,6 @@ class ChallengeQuestion < ActiveRecord::Base - belongs_to :challenge - attr_accessible :challenge_id, :option_name, :position, :right_key + # 选择题的选项内容 + belongs_to :challenge_choose + # right_key 选项是否是答案, position 选项的位置 + attr_accessible :challenge_choose_id, :option_name, :position, :right_key end diff --git a/app/models/challenge_tag.rb b/app/models/challenge_tag.rb index 5f5925f92..35b3f5be7 100644 --- a/app/models/challenge_tag.rb +++ b/app/models/challenge_tag.rb @@ -1,4 +1,5 @@ class ChallengeTag < ActiveRecord::Base - attr_accessible :challenge_id, :name + attr_accessible :challenge_id, :name, :challenge_choose_id belongs_to :challenge + belongs_to :challenge_choose end diff --git a/app/models/choose_outputs.rb b/app/models/choose_outputs.rb new file mode 100644 index 000000000..9a47a3b25 --- /dev/null +++ b/app/models/choose_outputs.rb @@ -0,0 +1,5 @@ +class ChooseOutputs < ActiveRecord::Base + # attr_accessible :title, :body + # user_id 与 challenge_choose_id 唯一确定用户此题的选项 + belongs_to :challenge_choose +end diff --git a/app/views/challenges/_answer_form.html.erb b/app/views/challenges/_answer_form.html.erb index cbc31b01a..406f01fc8 100644 --- a/app/views/challenges/_answer_form.html.erb +++ b/app/views/challenges/_answer_form.html.erb @@ -20,7 +20,7 @@

-
  • +
  • 保存 <% if @challenge.answer %> 取消 @@ -30,7 +30,7 @@ \ No newline at end of file diff --git a/app/views/challenges/_content_list.html.erb b/app/views/challenges/_content_list.html.erb index 50bbf8ccb..9c439ada2 100644 --- a/app/views/challenges/_content_list.html.erb +++ b/app/views/challenges/_content_list.html.erb @@ -6,10 +6,11 @@ <% end %> <% if User.current.manager_of_shixun?(@shixun) && @shixun.status == 0 %> +实践任务 - +多选任务 - +单选任务 + +选择题任务 + - <% end %> + <% end %> +
    <% @challenges.each_with_index do |challenge, index| -%>
    @@ -17,10 +18,8 @@ <% if challenge.st == 0 %> - <% elsif challenge.st == 1 %> + <% else %> - <% elsif challenge.st == 2 %> - <% end%> diff --git a/app/views/challenges/_edit_evaluating.html.erb b/app/views/challenges/_edit_evaluating.html.erb index f7190a85e..97cc18ed7 100644 --- a/app/views/challenges/_edit_evaluating.html.erb +++ b/app/views/challenges/_edit_evaluating.html.erb @@ -27,7 +27,16 @@ 输入输出
  • -
  • +
  • + - <% if @challenge.st == 1 %> - - <% elsif @challenge.st == 2 %> - + <% if false%> + <% if @challenge.st == 1 %> + + <% elsif @challenge.st == 2 %> + + <% end %> <% end %> <% end %> <% if @challenge.subject.blank? || !@editor.blank? %> diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index 197860477..46e28bf47 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -190,8 +190,5 @@ $("#challenge_execfile_path").hide(); }); -/* $("#evaluating_cancel").click(function(){ - $("#evaluating_edit").hide(); - $("#evaluating_show").show(); - })*/ + diff --git a/app/views/challenges/_score_form.html.erb b/app/views/challenges/_score_form.html.erb index 989eb74ce..174b10ea1 100644 --- a/app/views/challenges/_score_form.html.erb +++ b/app/views/challenges/_score_form.html.erb @@ -27,7 +27,7 @@
  • -
    +
      <% if @st == 0 %>
    1. 如果学员查看了参考答案,则不能得到相应的经验值
    2. diff --git a/app/views/challenges/_single_or_multiple_question.html.erb b/app/views/challenges/_single_or_multiple_question.html.erb new file mode 100644 index 000000000..c157d6773 --- /dev/null +++ b/app/views/challenges/_single_or_multiple_question.html.erb @@ -0,0 +1,507 @@ +<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %> +<%= javascript_include_tag '/editormd/editormd.min.js','/editormd/examples/js/jquery.min.js' %> + +<%= form_for("", :url => "", :html => {:id => 'challenge_choose_update'}) do |f| %> +<%#= form_tag(url_for(new_or_edit_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :type => @type, :position => @position)), :remote => true, :id => 'challenge_choose_update') do |f| %> +
    3. + 编辑 + 删除 +
    4. +
      +
      +
    5. + +
      + +
      + +
    6. + <% if @challenge_choose.blank? %> +
    7. + + + + +
    8. +
    9. + + + + +
    10. +
    11. + + + + +
    12. +
    13. + + + + +
    14. + <% else%> + <% @challenge_choose.challenge_questions.each_with_index do |question, index| %> +
    15. + + + + +
    16. + <% end %> + <% end %> +
        +
      • + + +
      • + +
      • + +
      +
      +
      +

      + +
    17. + +
      + +
      +

      +

      +
    18. +

      + +
      +
      +
    19. + + + > + + + + > + + + + > + + +
    20. +
    21. + + <%= select_tag :challenge_score, options_for_select([100, 200]), :name => 'challenge[score]', :class => " fl", :style => "height: 40px; width:170px;" %> +
      + +
    22. + +
      +
        +
      1. 如果学员答题错误,则不能得到相应的经验值
      2. +
      3. 如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币
      4. +
      +
      +
      +
      +

      + +
      +
      +
    23. + +
      + <% unless @challenge_choose.blank? %> + <% @challenge_choose.challenge_tags.each do |tag| %> +
      + + +
      + <% end %> + <% end %> +
      + + +
      + +添加 +
      +
    24. +

      +
      +
        +
      1. 学员答题正确将获得技能,否则不能获得技能
      2. +
      +
      +
      +
      +
    25. + ')">保存 + 取消 +
    26. +<% end %> + \ No newline at end of file diff --git a/app/views/challenges/_single_or_multiple_question_show.html.erb b/app/views/challenges/_single_or_multiple_question_show.html.erb new file mode 100644 index 000000000..c1ccb6a32 --- /dev/null +++ b/app/views/challenges/_single_or_multiple_question_show.html.erb @@ -0,0 +1,109 @@ +
      +
      +
    27. + 编辑 + 删除 +
    28. +
    29. + +
      + +
      +
    30. + <% @challenge_choose.challenge_questions.each_with_index do |option, index| %> +
    31. + +
      + <%= option.option_name %> +
      +
    32. + <% end %> +
      +

      +
      +
    33. + +
      + +
      +
    34. +
      +

      +
      +
    35. + +
      + <%= difficulty_type @challenge_choose.difficult %> +
      +
    36. +
    37. + +
      + <%= @challenge_choose.score.nil? ? 0 : @challenge_choose.score %>分 +
      +
    38. +
      +

      +
      +
    39. + +
      + <% if @challenge_choose.challenge_tags.blank? %> + 无 + <% else %> + <% @challenge_choose.challenge_tags.each do |tag| %> +
      + <%= tag.name %> +
      + <% end %> + <% end %> +
      +
    40. +
      +
      + + \ No newline at end of file diff --git a/app/views/challenges/_skill_form.html.erb b/app/views/challenges/_skill_form.html.erb index 2a506ed7d..99f88e0c2 100644 --- a/app/views/challenges/_skill_form.html.erb +++ b/app/views/challenges/_skill_form.html.erb @@ -11,15 +11,15 @@ <% end %> <% end %> -
      " id="add_shixun_skill"> +
      " id="add_shixun_skill">
      +添加
      -

      -
      +

      +
        <% if @st == 0 %>
      1. 学员未参考答案通过了本阶段的评测时将获得技能,否则不能获得技能
      2. @@ -29,10 +29,10 @@
      - - - - +
    41. + 保存 + 取消 +
    42. diff --git a/app/views/challenges/add_choose_question.js.erb b/app/views/challenges/add_choose_question.js.erb new file mode 100644 index 000000000..55a88fe8d --- /dev/null +++ b/app/views/challenges/add_choose_question.js.erb @@ -0,0 +1 @@ +$("#task_content").html("<%= j(render :partial => "single_or_multiple_question") %>"); \ No newline at end of file diff --git a/app/views/challenges/choose_type_show.js.erb b/app/views/challenges/choose_type_show.js.erb new file mode 100644 index 000000000..e589ae71b --- /dev/null +++ b/app/views/challenges/choose_type_show.js.erb @@ -0,0 +1,2 @@ +$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>"); +$("#challenge_choose_tab").html("<%= j(render :partial => "challenges/choose_tab") %>"); \ No newline at end of file diff --git a/app/views/challenges/edit.html.erb b/app/views/challenges/edit.html.erb index 7c4253a8d..b0f6fec1c 100644 --- a/app/views/challenges/edit.html.erb +++ b/app/views/challenges/edit.html.erb @@ -22,13 +22,9 @@ - <% elsif @st == 1 %> + <% else %> - - - <% elsif @st == 2%> - - + <% end %>

      阶段详情(第<%= @challenge.position %>关)

      @@ -40,51 +36,55 @@ <% end %> <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> - +实践任务 - +多选任务 - +单选任务 + +实践任务 + + + +选择题任务 <% end %>
    - +
    + <% if @tab == 1 || @tab.blank? %> + <%= render :partial => "edit_task_pass" %> + <% elsif @tab == 2 %> + <%= render :partial => "edit_evaluating" %> + <% elsif @tab == 3 %> + <%= render :partial => "edit_answer" %> + <% elsif @tab == 4 %> + <%= render :partial => "edit_scoring" %> + <% elsif @tab == 5 %> + <%= render :partial => "edit_skill" %> + <% elsif @tab == 6 %> + <%= render :partial => "edit_propaedeutics" %> + <% end %> +
    + + <% else %> + <%= render :partial => "choose_type" %> + <% end %>
    已保存
    diff --git a/app/views/challenges/edit.js.erb b/app/views/challenges/edit.js.erb new file mode 100644 index 000000000..ed1fdeb98 --- /dev/null +++ b/app/views/challenges/edit.js.erb @@ -0,0 +1 @@ +$("#task_show_page").html('<%= j(render :partial => "task_edit_page") %>'); \ No newline at end of file diff --git a/app/views/challenges/edit_choose_question.js.erb b/app/views/challenges/edit_choose_question.js.erb new file mode 100644 index 000000000..d1ce84abd --- /dev/null +++ b/app/views/challenges/edit_choose_question.js.erb @@ -0,0 +1,2 @@ +$("#task_content").html("<%= j(render :partial => "single_or_multiple_question") %>"); +$("#challenge_choose_tab").html("<%= j(render :partial => "challenges/choose_tab") %>"); \ No newline at end of file diff --git a/app/views/challenges/new_choose_question.js.erb b/app/views/challenges/new_choose_question.js.erb new file mode 100644 index 000000000..e589ae71b --- /dev/null +++ b/app/views/challenges/new_choose_question.js.erb @@ -0,0 +1,2 @@ +$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>"); +$("#challenge_choose_tab").html("<%= j(render :partial => "challenges/choose_tab") %>"); \ No newline at end of file diff --git a/app/views/challenges/new_or_edit_choose_question.js.erb b/app/views/challenges/new_or_edit_choose_question.js.erb new file mode 100644 index 000000000..b5c714994 --- /dev/null +++ b/app/views/challenges/new_or_edit_choose_question.js.erb @@ -0,0 +1 @@ +$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>"); \ No newline at end of file diff --git a/app/views/challenges/update_choose_question.js.erb b/app/views/challenges/update_choose_question.js.erb new file mode 100644 index 000000000..e589ae71b --- /dev/null +++ b/app/views/challenges/update_choose_question.js.erb @@ -0,0 +1,2 @@ +$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>"); +$("#challenge_choose_tab").html("<%= j(render :partial => "challenges/choose_tab") %>"); \ No newline at end of file diff --git a/app/views/courses/_courseList.html.erb b/app/views/courses/_courseList.html.erb index eff37ff70..d0b376b82 100644 --- a/app/views/courses/_courseList.html.erb +++ b/app/views/courses/_courseList.html.erb @@ -10,9 +10,15 @@ <% sy_author = User.find(sy.tea_id) %>
    -

    + <% if sy.name.length > 32 %> +

    <%= sy.name %>

    + <% else %> +

    + <%= sy.name %> +

    + <% end %>
    <%= link_to image_tag(url_to_avatar(sy_author), :width => "60", :height => "60", :class => "panel-warp-img mr10 fl", :alt => "用户"), user_path(sy_author), :target => '_blank' %> @@ -65,6 +71,11 @@ <% end %> + + +<% if false %>
    -
    +
    -

    " id="correct_tip"> - 正确 -

    -

    " id="error_tip"> - 错误 -

    - <% @game_challenge.challenge_questions.each_with_index do |question, i| %> -
    " onclick="choice_answer('<%= @st %>', this)"> - -
    - <%= (question.position + 65).chr %>. -
    -

    <%= question.option_name %>

    -
    -
    -
    +

    1.单选题

    +

    应在下列程序划线处填入的语句是()

    +
    
    +        
    + <% @game_challenge.challenge_chooses.each do |choose| %> + <% choose.challenge_questions.each_with_index do |question, i| %> +
    " onclick="choice_answer('<%= @st %>', this)"> + + + + +
    + <%= (question.position + 65).chr %>. +
    +

    <%= question.option_name %>

    +
    +
    +
    + <% end %> <% end %> +

    -
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/games/_code_actions.html.erb b/app/views/games/_code_actions.html.erb index 1bac8a11c..7ad488035 100644 --- a/app/views/games/_code_actions.html.erb +++ b/app/views/games/_code_actions.html.erb @@ -5,6 +5,12 @@ 加载上次通过的代码
    <% end %> +
    + <% if @game.challenge.position > 1 %> + <%= link_to "上一关 ", {:controller => 'games', :action => "prev_step", :id => @game, :myshixun_id => @myshixun}, + :class => "shixun-task-btn task-btn-blue mr15 mt8", :id => "prev_step", :remote => true %> + <% end %> +
    <% if @st == 0 %> 评测 @@ -12,25 +18,19 @@ 评测 <% end %>
    -
    - <% if @game.challenge.position > 1 %> - <%= link_to "上一关 ", {:controller => 'games', :action => "prev_step", :id => @game, :myshixun_id => @myshixun}, - :class => "shixun-task-btn task-btn-blue mr15 mt8", :id => "prev_step", :remote => true %> - <% end %> -
    <% if @game.status == 1 %> 评测中.. <% end %> - <% if show_next_stage?(@game, @myshixun.shixun.try(:status)) %> <% if @had_done == 0 %> + <% if show_next_stage?(@game, @myshixun.shixun.try(:status)) %> <%= link_to "下一关 ", {:controller => 'games', :action => "next_step", :id => @game, :myshixun_id => @myshixun}, :class => "shixun-task-btn task-btn-blue mr15 mt8", :id => "next_step", :remote => true %> - <% else %> - 退出实训 <% end %> - <% end %> + <% else %> + 离开 + <% end %>
    - +
    <% if User.current.logged? %> @@ -48,7 +48,7 @@
    <% end %> <% end %> -
    +

      账户管理

      diff --git a/app/views/layouts/base_myshixun.html.erb b/app/views/layouts/base_myshixun.html.erb index 2b5e6831a..f633e36f4 100644 --- a/app/views/layouts/base_myshixun.html.erb +++ b/app/views/layouts/base_myshixun.html.erb @@ -9,7 +9,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/font-awesome','css/taskstyle', 'css/project','css/popup','repository','css/gantt','css/cssPlus-v.0.2-build', 'css/edu-common','css/edu-public', 'css/edu-popup', 'css/edu-tooltipster' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/font-awesome','css/taskstyle', 'css/project','css/popup','repository','css/gantt','css/cssPlus-v.0.2-build', 'css/edu-common','css/edu-public', 'css/edu-popup', 'css/edu-tooltipster', 'css/magic-check' %> <%= javascript_include_tag 'edu/application', 'edu/edu_tpi' %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/layouts/base_shixun.html.erb b/app/views/layouts/base_shixun.html.erb index aa188b0b6..223d2687b 100644 --- a/app/views/layouts/base_shixun.html.erb +++ b/app/views/layouts/base_shixun.html.erb @@ -35,11 +35,13 @@ :action => 'shixun_show', :id => @shixun, :repository_id => shixun_repository(@shixun).try(:identifier)}), - :class => (params[:controller] == 'repositories' ? 'active' : ''), - :target => "_blank" %> + :class => (params[:controller] == 'repositories' ? 'active' : '') %> -
    • ">合作者
    • -
    • ">配置
    • + <% end %> +
    • ">合作者
    • + + <% if User.current.manager_of_shixun?(@shixun) %> +
    • ">配置
    • <% end %>
    diff --git a/app/views/managements/classroom_classment.html.erb b/app/views/managements/classroom_classment.html.erb index e76259dab..e8f8eae86 100644 --- a/app/views/managements/classroom_classment.html.erb +++ b/app/views/managements/classroom_classment.html.erb @@ -34,6 +34,7 @@ + <%#= link_to "导出Excel", export_excel_managements_path(:format => "xls"), :class => "task-btn task-btn-blue ml5 mt3 fr mb5 mr30" %>
    <% end %>
    diff --git a/app/views/projects/_no_data.html.erb b/app/views/projects/_no_data.html.erb index 96a27a999..5cf4e5cfe 100644 --- a/app/views/projects/_no_data.html.erb +++ b/app/views/projects/_no_data.html.erb @@ -1,4 +1,4 @@ -
    +

    没有数据可以显示!

    \ No newline at end of file diff --git a/app/views/repositories/commits.html.erb b/app/views/repositories/commits.html.erb index 0502b6235..0103552db 100644 --- a/app/views/repositories/commits.html.erb +++ b/app/views/repositories/commits.html.erb @@ -1,4 +1,4 @@ -
    +
      <%= render :partial => 'shixun_navigation' %> diff --git a/app/views/repositories/shixun_commit_diff.html.erb b/app/views/repositories/shixun_commit_diff.html.erb index 1570978b9..bd56d8878 100644 --- a/app/views/repositories/shixun_commit_diff.html.erb +++ b/app/views/repositories/shixun_commit_diff.html.erb @@ -1,4 +1,4 @@ -
      +
      <%=link_to "返回提交历史".html_safe, diff --git a/app/views/repositories/shixun_show.html.erb b/app/views/repositories/shixun_show.html.erb index 287b74392..39423fdb3 100644 --- a/app/views/repositories/shixun_show.html.erb +++ b/app/views/repositories/shixun_show.html.erb @@ -3,9 +3,14 @@

      - 使用Git提交代码时,请在Git客户端填写如下信息:
      - * 用户名:请使用您绑定的邮箱
      - * 口令:请使用您的登录口令
      + 提交代码的方法:
      + 1、在你自己的电脑安装Git tortoise客户端,
      + 或者其他你熟悉的Git客户端;
      + 2、在Git客户端向左侧的地址提交代码。
      + 注意:
      + 请务必在Git客户端填写如下信息:
      + * 用户名:使用您在本平台绑定的邮箱
      + * 口令:使用您在本平台的登录口令

      diff --git a/app/views/shixuns/_settings_show.html.erb b/app/views/shixuns/_settings_show.html.erb index 689515e2b..fca669be8 100644 --- a/app/views/shixuns/_settings_show.html.erb +++ b/app/views/shixuns/_settings_show.html.erb @@ -1,5 +1,5 @@ -
      -
      +
      +

      diff --git a/app/views/shixuns/_shixun_list.html.erb b/app/views/shixuns/_shixun_list.html.erb index 7a705d49c..aaecb8bd8 100644 --- a/app/views/shixuns/_shixun_list.html.erb +++ b/app/views/shixuns/_shixun_list.html.erb @@ -1,4 +1,4 @@ -