Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course
This commit is contained in:
commit
3efae6bde2
|
@ -91,7 +91,7 @@ class ExerciseController < ApplicationController
|
|||
@exercise.time = params[:exercise][:time]
|
||||
@exercise.end_time = params[:exercise][:end_time]
|
||||
@exercise.publish_time = params[:exercise][:publish_time]
|
||||
@exercise.publish_time = params[:exercise][:show_result]
|
||||
@exercise.show_result = params[:exercise][:show_result]
|
||||
if @exercise.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -18,11 +18,19 @@ module ExerciseHelper
|
|||
|
||||
def convert_to_char(str)
|
||||
result = ""
|
||||
if str.count >= 1
|
||||
for i in 0 .. str.count do i
|
||||
result += (str[i].to_i + 64).chr
|
||||
length = str.length
|
||||
unless str.nil?
|
||||
if length === 1
|
||||
result += (str.to_i + 64).chr
|
||||
return result
|
||||
elsif length > 1
|
||||
for i in 0...length
|
||||
result += (str[i].to_i + 64).chr
|
||||
end
|
||||
return result
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
end
|
|
@ -319,7 +319,7 @@
|
|||
<div id="polls_head_edit">
|
||||
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
|
||||
<div class="mb5" style="display: none">目前试卷总分:<span class="c_red">20分</span></div>
|
||||
<!-- 问题 -->
|
||||
<div id="poll_content">
|
||||
<%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%>
|
||||
|
@ -340,7 +340,7 @@
|
|||
|
||||
<div class="ur_buttons"> <a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
|
||||
<div class="polls_cha">
|
||||
<input name="show_result" value="" type="checkbox">
|
||||
<input name="exercise[show_result]" value="" type="checkbox">
|
||||
<label for="">允许学生查看测验结果</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<%#= form_for ExerciseQuestion.new,:url =>create_exercise_question_exercise_path(@exercise.id),:remote => true do |f|%>
|
||||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'exercise',
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'exercise',
|
||||
:action => 'create_exercise_question',
|
||||
:course_id => @course.id
|
||||
},:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="2" type="hidden">
|
||||
<input class="questionTitle" name="questions_title" id="poll_questions_title" placeholder="请输入多选题题目" type="text">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
|
@ -51,4 +57,5 @@
|
|||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,6 +1,8 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %><span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span></div>
|
||||
<%= exercise_question.question_title %>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
</div>
|
||||
|
||||
<%#= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
</div>
|
||||
<%#= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||||
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=exercise_question.id%>" onclick="chooseQuestionType('mcq',<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="checkbox" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--多选题显示 end-->
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_mcq_<%=exercise_question.id%>">
|
||||
</div>
|
||||
<div id="div_mcq_<%=exercise_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
|
||||
<ul>
|
||||
<!--
|
||||
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%#=poll_question.id%>);insert_MC('mcq',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单选</a></li>
|
||||
-->
|
||||
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=exercise_question.id%>);insert_MCQ('mcq',<%=exercise_question.question_number%>,<%=exercise_question.id%>);">多选</a></li>
|
||||
<!--
|
||||
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%#=poll_question.id%>);insert_SINGLE('mcq',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单行主观</a></li>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,26 @@
|
|||
<% if @is_insert %>
|
||||
$("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>');
|
||||
<% else %>
|
||||
$("#new_poll_question").html("");
|
||||
|
||||
$("#poll_content").append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||
"<% if @exercise_questions.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% elsif @exercise_questions.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% elsif @exercise_questions.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<% if @exercise_questions.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% elsif @exercise_questions.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% elsif @exercise_questions.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
52
db/schema.rb
52
db/schema.rb
|
@ -241,6 +241,58 @@ 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
|
||||
|
|
Loading…
Reference in New Issue