Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

This commit is contained in:
huang 2015-11-20 18:39:44 +08:00
commit a3122a9a2c
4 changed files with 8 additions and 13 deletions

View File

@ -40,6 +40,7 @@ class ExerciseController < ApplicationController
else
if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id)
eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
end
# @percent = get_percent(@exercise,User.current)
exercise_questions = @exercise.exercise_questions
@ -285,13 +286,7 @@ class ExerciseController < ApplicationController
@exercise.exercise_status = 2
@exercise.publish_time = Time.now
if @exercise.save
if params[:is_remote]
redirect_to exercise_index_url(:course_id => @course.id)
else
respond_to do |format|
format.js
end
end
redirect_to exercise_index_url(:course_id=> @course.id)
end
end
@ -431,7 +426,7 @@ class ExerciseController < ApplicationController
def commit_exercise
# 老师不需要提交
if User.current.allowed_to?(:as_teacher,@course)
@exercise.update_attributes(:show_result => params[:exercise][:show_result])
@exercise.update_attributes(:show_result => params[:show_result])
redirect_to exercise_url(@exercise)
# REDO: 提示提交成功
else

View File

@ -21,7 +21,7 @@
<% if exercise.exercise_status == 1 %>
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>);">发布试卷</a></li>
<% else %>
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_exercise(<%= exercise.id%>);">取消发布</a></li>
<li class="pollsbtn fl ml5 pollsbtn_grey">发布试卷</li>
<% end%>
<%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>

View File

@ -1,4 +1,4 @@
<%= form_for(exercise,
<%= form_for('',
:html => { :multipart => true },
:url => {:controller => 'exercise',
:action => 'commit_exercise',
@ -7,8 +7,8 @@
<div class="ur_buttons">
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
<div class="polls_cha">
<%= f.check_box :show_result, :value => exercise.show_result%>
<%= label_tag 'exercise_show_result', '允许学生查看测验结果' %>
<%= f.check_box 'show_result', :value => exercise.show_result%>
<%= label_tag '_show_result', '允许学生查看测验结果' %>
<!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true">
<label for="">允许学生查看测验结果</label>-->
</div>

View File

@ -37,7 +37,7 @@
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>问卷发布后将不能对问卷进行修改,<br />是否确定发布该问卷</p>" +
"<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'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +