From 265fe08b2c7638d4b8d21db4ffa809f8bff10004 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 18 Nov 2015 10:49:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=B5=8B=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 1 + app/helpers/exercise_helper.rb | 11 +++++- app/views/exercise/_edit_MC.html.erb | 0 app/views/exercise/_edit_MCQ.html.erb | 0 app/views/exercise/_edit_head.html.erb | 4 +- app/views/exercise/_edit_single.html.erb | 0 app/views/exercise/_exercise_content.html.erb | 37 +++++++++---------- app/views/exercise/_exercise_form.html.erb | 4 +- app/views/exercise/_new_MC.html.erb | 9 ++++- app/views/exercise/_new_MCQ.html.erb | 37 +++++++++++++------ app/views/exercise/_new_single.html.erb | 14 +++++-- app/views/exercise/_show_MC.html.erb | 36 ++++++++++++++++++ app/views/exercise/_show_MCQ.html.erb | 0 app/views/exercise/_show_head.html.erb | 14 +++++-- app/views/exercise/_show_single.html.erb | 0 public/stylesheets/courses.css | 11 +++++- 16 files changed, 133 insertions(+), 45 deletions(-) create mode 100644 app/views/exercise/_edit_MC.html.erb create mode 100644 app/views/exercise/_edit_MCQ.html.erb create mode 100644 app/views/exercise/_edit_single.html.erb create mode 100644 app/views/exercise/_show_MC.html.erb create mode 100644 app/views/exercise/_show_MCQ.html.erb create mode 100644 app/views/exercise/_show_single.html.erb 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 %>
- + " > <%= calendar_for('exercise_publish_time')%>
<%# if edit_mode %> <%# end %>
- + " > <%= calendar_for('exercise_end_time')%>
考试时长:分钟
diff --git a/app/views/exercise/_edit_single.html.erb b/app/views/exercise/_edit_single.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/exercise/_exercise_content.html.erb b/app/views/exercise/_exercise_content.html.erb index bffd7e221..9e139fe32 100644 --- a/app/views/exercise/_exercise_content.html.erb +++ b/app/views/exercise/_exercise_content.html.erb @@ -1,22 +1,21 @@ - -<% exercise.exercise_questions.each do |poll_question|%> -
- - \ 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 @@
- - + +
    +
  • + + 分 +
  • +
  • @@ -23,6 +28,9 @@
- +
\ 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") %> + + +
+
+ + + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> + + + + <% end %> + +
+ +
+
+
+ +
+
+ \ 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