diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb
index 4d2e266b5..f51bf9a2c 100644
--- a/app/controllers/exercise_controller.rb
+++ b/app/controllers/exercise_controller.rb
@@ -4,6 +4,7 @@ class ExerciseController < ApplicationController
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit,:update]
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list]
+ include ExerciseHelper
def index
remove_invalid_exercise(@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb
index 410a9936b..b9cd9c175 100644
--- a/app/helpers/exercise_helper.rb
+++ b/app/helpers/exercise_helper.rb
@@ -3,7 +3,7 @@ module ExerciseHelper
#判断用户是否已经提交了问卷
def has_commit_exercise?(exercise_id, user_id)
- pu = PollUser.find_by_poll_id_and_user_id(excercise_id, user_id)
+ pu = ExerciseUser.find_by_excercise_id_and_user_id(exercise_id, user_id)
if pu.nil?
false
else
@@ -11,4 +11,13 @@ module ExerciseHelper
end
end
+ 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
+ end
+ end
+ end
+
end
\ No newline at end of file
diff --git a/app/views/exercise/_edit_MC.html.erb b/app/views/exercise/_edit_MC.html.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/exercise/_edit_MCQ.html.erb b/app/views/exercise/_edit_MCQ.html.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb
index 21326e2c8..9868a4465 100644
--- a/app/views/exercise/_edit_head.html.erb
+++ b/app/views/exercise/_edit_head.html.erb
@@ -7,14 +7,14 @@
<%# end %>
-
-
- <% if poll_question.question_type == 1%>
- <%= render :partial => 'edit_MC', :locals => {:poll_question => poll_question} %>
- <% elsif poll_question.question_type == 2%>
- <%= render :partial => 'edit_MCQ', :locals => {:poll_question => poll_question} %>
- <% elsif poll_question.question_type == 3%>
- <%= render :partial => 'edit_single', :locals => {:poll_question => poll_question} %>
+<% exercise.exercise_questions.each do |exercise_question|%>
+
+
+ <% if exercise_question.question_type == 1%>
+ <%= render :partial => 'show_MC', :locals => {:exercise_question => exercise_question} %>
+ <% elsif exercise_question.question_type == 2%>
+ <%= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %>
+ <% elsif exercise_question.question_type == 3%>
+ <%= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %>
+ <% end%>
+
+
+ <% if exercise_question.question_type == 1%>
+ <%= render :partial => 'edit_MC', :locals => {:exercise_question => exercise_question} %>
+ <% elsif exercise_question.question_type == 2%>
+ <%= render :partial => 'edit_MCQ', :locals => {:exercise_question => exercise_question} %>
+ <% elsif exercise_question.question_type == 3%>
+ <%= render :partial => 'edit_single', :locals => {:exercise_question => exercise_question} %>
<% end%>
diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb
index 3a0230781..c4b7ee421 100644
--- a/app/views/exercise/_exercise_form.html.erb
+++ b/app/views/exercise/_exercise_form.html.erb
@@ -231,7 +231,7 @@
//添加标题时确定按钮
function add_poll_question(doc)
{
- var title = $.trim($("#question_title").val());
+ var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//修改标题时确定按钮
@@ -340,7 +340,7 @@
diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb
index de7e9ba31..5748713de 100644
--- a/app/views/exercise/_new_MC.html.erb
+++ b/app/views/exercise/_new_MC.html.erb
@@ -9,10 +9,15 @@
问题:
-
+
diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb
index cabd9bf57..4163e9f13 100644
--- a/app/views/exercise/_new_MCQ.html.erb
+++ b/app/views/exercise/_new_MCQ.html.erb
@@ -6,34 +6,49 @@
-
+
\ No newline at end of file
diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb
index 8ef1e1e04..f48c7673d 100644
--- a/app/views/exercise/_new_single.html.erb
+++ b/app/views/exercise/_new_single.html.erb
@@ -1,11 +1,16 @@
\ No newline at end of file
diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb
new file mode 100644
index 000000000..bfaea32aa
--- /dev/null
+++ b/app/views/exercise/_show_MC.html.erb
@@ -0,0 +1,36 @@
+
+
第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)
+ <%= exercise_question.question_title %>(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)
+
+ <%#= 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") %>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/exercise/_show_head.html.erb b/app/views/exercise/_show_head.html.erb
index f7d2b9295..ec9f06035 100644
--- a/app/views/exercise/_show_head.html.erb
+++ b/app/views/exercise/_show_head.html.erb
@@ -1,6 +1,12 @@
-
-
+
+
+
<%= exercise.exercise_name%>
- <%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%>
+
+ 发布时间:<%=Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.publish_time%>
+ 截止时间:<%=Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %>
+ 考试时长:<%= exercise.time %>分钟
+
<%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%>
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index da393afaa..e267b9010 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -1156,4 +1156,13 @@ a:hover.btn_cancel{ color:#666;}
.mr118 {margin-right:118px !important;}
.questionContainer {width:698px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
.questionTitle{ width:644px; height:30px; border:1px solid #cbcbcb; padding-left:5px; background:#fff;}
-.examTime {width:40px; border:1px solid #cbcbcb; outline:none; height:28px; text-align:center; padding-left:0px; }
\ No newline at end of file
+.examTime {width:40px; border:1px solid #cbcbcb; outline:none; height:28px; text-align:center; padding-left:0px; }
+.testStatus{width:698px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px; background:#ffffff; position:relative; color:#767676;}
+.testEdit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; bottom:10px; right:10px; position:absolute;}
+a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;}
+.mr100 {margin-right:100px;}
+.testDesEdit {width:670px; overflow:hidden;}
+.testEditTitle{ padding:10px 0px ; float:left; width:564px; }
+.questionEditContainer {border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px; margin-top:10px;}
+.fillInput {border:1px solid #cbcbcb; padding-left:5px; background-color:#ffffff; width:693px; height:30px; color:#888888;}
+.mr130 {margin-right:130px;}
\ No newline at end of file