pre_develop
daiao 6 years ago
commit f3a25e9812

@ -104,6 +104,7 @@ class ExerciseBankController < ApplicationController
:question_type => params[:question_type] || 1,
:question_number => @exercise.exercise_bank_questions.count + 1,
:question_score => params[:question_score],
:shixun_name => params[:question_type] == '5' ? params[:shixun_name] : nil,
:shixun_id => params[:shixun],
:max_choices => params[:max_choices].to_i || 0,
:min_choices => params[:min_choices].to_i || 0
@ -271,6 +272,7 @@ class ExerciseBankController < ApplicationController
end
end
if @exercise_question.question_type == 5
@exercise_question.shixun_name = params[:shixun_name].strip if !params[:shixun_name].blank?
question_score = 0
@exercise_question.exercise_bank_shixun_challenges.each_with_index do |challenge, index|
challenge.question_score = params[:question_score][index]

@ -372,6 +372,7 @@ class ExerciseController < ApplicationController
:question_type => params[:question_type] || 1,
:question_number => @exercise.exercise_questions.count + 1,
:question_score => params[:question_type] == '5' ? 0 : params[:question_score],
:shixun_name => params[:question_type] == '5' ? params[:shixun_name] : nil,
:shixun_id => params[:shixun]
}
@exercise_questions = @exercise.exercise_questions.new option
@ -512,6 +513,7 @@ class ExerciseController < ApplicationController
end
end
if @exercise_question.question_type == 5
@exercise_question.shixun_name = params[:shixun_name].strip if !params[:shixun_name].blank?
question_score = 0
@exercise_question.exercise_shixun_challenges.each_with_index do |challenge, index|
challenge.question_score = params[:question_score][index]
@ -1508,7 +1510,8 @@ class ExerciseController < ApplicationController
:question_type => q[:question_type] || 1,
:question_number => q[:question_number],
:question_score => q[:question_score],
:shixun_id => q[:shixun_id]
:shixun_id => q[:shixun_id],
:shixun_name => q[:shixun_name]
}
exercise_bank_question = exercise_bank.exercise_bank_questions.new option

@ -117,7 +117,7 @@ class QuestionBanksController < ApplicationController
else
@courses = User.current.courses.where("is_delete = 0 and is_end = 0").select{ |course| User.current.has_teacher_role(course)}
end
@homework_ids = params[:check_homework_bank] || params[:bank_id].split(" ")
@homework_ids = params[:check_homework_bank] || params[:bank_id].split(" ") unless params[:is_observe]
@search = params[:search]
respond_to do |format|
format.js

@ -7034,7 +7034,8 @@ def quote_exercise_bank exercise, course
:question_type => q[:question_type] || 1,
:question_number => q[:question_number],
:question_score => q[:question_score],
:shixun_id => q[:shixun_id]
:shixun_id => q[:shixun_id],
:shixun_name => q[:shixun_name]
}
exercise_question = new_exercise.exercise_questions.new option

@ -3,7 +3,7 @@
<p class="fl mt15 font-16 mb10">实训题</p>
<p class="clearfix mb10">
<label class="panel-form-label fl"><span class="mr10">标题</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing candiate_answer" name='question_answer[]' id="poll_questions_name_<%=exercise_question.id %>" placeholder="请输入实训标题"><%= exercise_question.shixun.name %></textarea>
<textarea class="panel-form-width2-690 fl panel-box-sizing" maxlength="100" name='shixun_name' id="poll_questions_name_<%=exercise_question.id %>" placeholder="请输入实训标题"><%= exercise_question.shixun_name %></textarea>
</p>
<li class="clearfix pr mb20">
<input name="question_type" value="5" type="hidden">

@ -111,7 +111,7 @@
var score = $.trim($("#poll_question_score_"+ id).val());
var standard_ans = $.trim($("#exercise_choice_" + id).val());
if(name===""){
notice_box("题目标题");
notice_box("题目标题不能为空");
}
if(title.length == 0 || score.length == 0){
notice_box("要求/分数不能为空");

@ -162,7 +162,7 @@
<% end %>
</div>
<% if exercise_question.question_type == 5 %>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun_name %></p>
<% end %>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<% case exercise_question.question_type %>

@ -140,7 +140,7 @@
<% end %>
</div>
<% if exercise_question.question_type == 5 %>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun_name %></p>
<% end %>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<% case exercise_question.question_type %>

@ -8,7 +8,10 @@
<input name="question_type" value="5" type="hidden">
<input name="shixun" value="<%= @shixun.id %>" type="hidden">
<input name="quest_id" id="quest_id" value="0" type="hidden">
<p class="clearfix mb10" style="margin-left: 78px;"><%= @shixun.name %></p>
<p class="clearfix mb10">
<label class="panel-form-label fl"><span class="mr10">标题</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" maxlength="100" name='shixun_name' id="poll_questions_name" placeholder="请输入实训标题"><%= @shixun.name %></textarea>
</p>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">要求</span></label>
<textarea id="poll_questions_title" name="question_title" class="panel-form-width2-690 fl panel-box-sizing undis"></textarea>

@ -16,7 +16,7 @@
</p>
<% end %>
</div>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun_name %></p>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<div class="pl15 pr15 pt10 pb10 bor-top-greyE">
<% exercise_question.exercise_shixun_challenges.each_with_index do |exercise_challenge,index| %>

@ -256,7 +256,7 @@
<% end %>
</div>
<% if exercise_question.question_type == 5 %>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun_name %></p>
<% end %>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word">
<%= exercise_question.question_title.html_safe %>

@ -1,7 +1,10 @@
<%= form_for("",:url => update_exercise_question_exercise_bank_index_path(:exercise_question => exercise_question.id),:html => {:id => "update_exercise_question_#{exercise_question.id}"}) do |f|%>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 fillin_Temp" id="poll_answers_<%= exercise_question.id %>">
<p class="fl mt15 font-16 mb10">实训题</p>
<p class="clearfix mb10" style="margin-left: 78px;"><%= exercise_question.shixun.name %></p>
<p class="clearfix mb10">
<label class="panel-form-label fl"><span class="mr10">标题</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" maxlength="100" name='shixun_name' id="poll_questions_name_<%=exercise_question.id %>" placeholder="请输入实训标题"><%= exercise_question.shixun_name %></textarea>
</p>
<li class="clearfix pr mb20">
<input name="question_type" value="5" type="hidden">
<label class="panel-form-label fl"><span class="mr10">要求</span></label>

@ -8,7 +8,10 @@
<input name="question_type" value="5" type="hidden">
<input name="shixun" value="<%= @shixun.id %>" type="hidden">
<input name="quest_id" id="quest_id" value="0" type="hidden">
<p class="clearfix mb10" style="margin-left: 78px;"><%= @shixun.name %></p>
<p class="clearfix mb10">
<label class="panel-form-label fl"><span class="mr10">标题</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" maxlength="100" name='shixun_name' id="poll_questions_name" placeholder="请输入实训标题"><%= @shixun.name %></textarea>
</p>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">要求</span></label>
<textarea id="poll_questions_title" name="question_title" class="panel-form-width2-690 fl panel-box-sizing undis"></textarea>

@ -14,7 +14,7 @@
<a href="javascript:void(0)" onclick="exQuestionEdit(<%= exercise_question.id%>, <%= exercise_question.question_type %>);"><i data-tip-down="编辑" class="fa fa-pencil color-orange05"></i></a>
</p>
</div>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun_name %></p>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<div class="pl15 pr15 pt10 pb10 bor-top-greyE">
<% exercise_question.exercise_bank_shixun_challenges.each_with_index do |exercise_challenge,index| %>

@ -80,7 +80,7 @@
<% end %>
</div>
<% if exercise_question.question_type == 5 %>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun.name %></p>
<p class="pl15 pr15 mb10"><%= exercise_question.shixun_name %></p>
<% end %>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= exercise_question.question_title.html_safe %></div>
<% case exercise_question.question_type %>

@ -31,4 +31,17 @@
</div>
</div>
</div>
</div>
</div>
<script>
function search_hw_course(url){
$.ajax({
url: url,
type: 'post',
data: {search: $("#hb_search_course_input").val(), is_observe: true},
success: function(data){
}
});
}
</script>

@ -0,0 +1,14 @@
class AddShixunNameToExQuestion < ActiveRecord::Migration
def change
add_column :exercise_questions, :shixun_name, :string
add_column :exercise_bank_questions, :shixun_name, :string
ExerciseQuestion.where(question_type: 5).each do |question|
question.update_column("shixun_name", question.shixun.try(:name))
end
ExerciseBankQuestion.where(question_type: 5).each do |question|
question.update_column("shixun_name", question.shixun.try(:name))
end
end
end

@ -1361,16 +1361,6 @@ function choose_course_to_send_hb(){
}
}
function search_hw_course(url){
$.ajax({
url: url,
type: 'post',
data: {search: $("#hb_search_course_input").val(), is_observe: true},
success: function(data){
}
});
}
function submit_send_hb_to_course(){
if($("input[name='course_id']:checked").length >= 1){
$("#search_course_notice_h").html("").hide();

@ -1103,6 +1103,15 @@ function add_ex_question(doc,quest_type)
var title = $.trim($("#poll_questions_title").val());
var score = $.trim($("#question_score").val());
var standard_ans = $.trim($("#exercise_choice_" + quest_type).val());
if (quest_type == 5) {
var name = $.trim($("#poll_questions_name").val());
if(name===""){
notice_box("题目标题不能为空");
result = false;
}
}
if(title.length == 0){
if(quest_type != 5){
notice_box("题目标题不能为空");
@ -1414,6 +1423,13 @@ function edit_poll_question(doc,id,quest_type) {
var title = $.trim($("#poll_questions_title_" + id).val());
var score = $.trim($("#poll_question_score_" + id).val());
var standard_ans = $.trim($("#exercise_choice_" + id).val());
if (quest_type == 5) {
var name = $.trim($("#poll_questions_name_" + id).val());
if(name===""){
notice_box("题目标题不能为空");
result = false;
}
}
if (title.length == 0) {
if (quest_type != 5) {
notice_box("题目标题不能为空");

Loading…
Cancel
Save