Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course
This commit is contained in:
commit
20f7560b07
|
@ -1,7 +1,7 @@
|
|||
class ExerciseController < ApplicationController
|
||||
layout "base_courses"
|
||||
|
||||
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer]
|
||||
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise]
|
||||
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list]
|
||||
include ExerciseHelper
|
||||
|
||||
|
@ -261,7 +261,7 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
|
||||
# 发布试卷
|
||||
def publish_excercise
|
||||
def publish_exercise
|
||||
@exercise.exercise_status = 2
|
||||
@exercise.publish_time = Time.now
|
||||
if @exercise.save
|
||||
|
@ -276,16 +276,17 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
|
||||
# 重新发布试卷
|
||||
def republish_excercise
|
||||
# 重新发布的时候会删除所有的答题
|
||||
def republish_exercise
|
||||
@exercise.exercise_questions.each do |exercise_question|
|
||||
exercise_question.exercise_ansers.destroy_all
|
||||
end
|
||||
# @poll.poll_users.destroy_all
|
||||
# @poll.polls_status = 1
|
||||
# @poll.save
|
||||
# respond_to do |format|
|
||||
# format.js
|
||||
# end
|
||||
@exercise.exercise_users.destroy_all
|
||||
@exercise.exercise_status = 1
|
||||
@exercise.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def student_exercise_list
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript">
|
||||
function close_alert_form(){hideModal("#alert_form");}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="alert_form">
|
||||
<div class="upload_con">
|
||||
<div class="polls_alert_upload_box">
|
||||
<p class="polls_alert_box_p">
|
||||
<%= message%>
|
||||
</p>
|
||||
<div class="polls_alert_btn_box">
|
||||
<a class="upload_btn" onclick="close_alert_form();">
|
||||
确 定
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -19,9 +19,9 @@
|
|||
<% end%>
|
||||
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="">发布试卷</a></li>
|
||||
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>);">发布试卷</a></li>
|
||||
<% elsif exercise.exercise_status == 2%>
|
||||
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="">取消发布</a></li>
|
||||
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_exercise(<%= exercise.id%>);">取消发布</a></li>
|
||||
<% else%>
|
||||
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >发布试卷</li>
|
||||
<% end%>
|
||||
|
|
|
@ -1,4 +1,63 @@
|
|||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<script type="text/javascript">
|
||||
function republish_exercise(exercise_id)
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/republish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
|
||||
function exercise_submit(exercise_id,exercise_name)
|
||||
{
|
||||
if(exercise_name == 0)
|
||||
{
|
||||
alert("试卷标题不能为空");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>问卷发布后将不能对问卷进行修改,<br />是否确定发布该问卷?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/publish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="polls_content02" id="exercise">
|
||||
<%= render :partial => 'exercises_list'%>
|
||||
</div><!--问卷内容end-->
|
|
@ -0,0 +1,10 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','111px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
|
@ -0,0 +1,10 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise_content',:locals => {:exercise => @exercise}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','80px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
|
@ -152,6 +152,8 @@ RedmineApp::Application.routes.draw do
|
|||
get 'statistics_result'
|
||||
get 'student_exercise_list'
|
||||
get 'export_exercise'
|
||||
get 'publish_exercise'
|
||||
get 'republish_exercise'
|
||||
post 'create_exercise_question'
|
||||
post 'commit_answer'
|
||||
post 'commit_exercise'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddEndAtToExerciseUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercise_users, :end_at, :datetime
|
||||
end
|
||||
end
|
55
db/schema.rb
55
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20151118015638) do
|
||||
ActiveRecord::Schema.define(:version => 20151119124148) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -241,58 +241,6 @@ ActiveRecord::Schema.define(:version => 20151118015638) do
|
|||
|
||||
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
|
||||
|
||||
create_table "code_review_assignments", :force => true do |t|
|
||||
t.integer "issue_id"
|
||||
t.integer "change_id"
|
||||
t.integer "attachment_id"
|
||||
t.string "file_path"
|
||||
t.string "rev"
|
||||
t.string "rev_to"
|
||||
t.string "action_type"
|
||||
t.integer "changeset_id"
|
||||
end
|
||||
|
||||
create_table "code_review_project_settings", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "tracker_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "updated_by"
|
||||
t.boolean "hide_code_review_tab", :default => false
|
||||
t.integer "auto_relation", :default => 1
|
||||
t.integer "assignment_tracker_id"
|
||||
t.text "auto_assign"
|
||||
t.integer "lock_version", :default => 0, :null => false
|
||||
t.boolean "tracker_in_review_dialog", :default => false
|
||||
end
|
||||
|
||||
create_table "code_review_user_settings", :force => true do |t|
|
||||
t.integer "user_id", :default => 0, :null => false
|
||||
t.integer "mail_notification", :default => 0, :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "code_reviews", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "change_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "line"
|
||||
t.integer "updated_by_id"
|
||||
t.integer "lock_version", :default => 0, :null => false
|
||||
t.integer "status_changed_from"
|
||||
t.integer "status_changed_to"
|
||||
t.integer "issue_id"
|
||||
t.string "action_type"
|
||||
t.string "file_path"
|
||||
t.string "rev"
|
||||
t.string "rev_to"
|
||||
t.integer "attachment_id"
|
||||
t.integer "file_count", :default => 0, :null => false
|
||||
t.boolean "diff_all"
|
||||
end
|
||||
|
||||
create_table "comments", :force => true do |t|
|
||||
t.string "commented_type", :limit => 30, :default => "", :null => false
|
||||
t.integer "commented_id", :default => 0, :null => false
|
||||
|
@ -614,6 +562,7 @@ ActiveRecord::Schema.define(:version => 20151118015638) do
|
|||
t.datetime "start_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "end_at"
|
||||
end
|
||||
|
||||
create_table "exercises", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue