Browse Source

Unique answer question, improving UI see BT#5938

Julio Montoya 12 years ago
parent
commit
c283596ef8
3 changed files with 13 additions and 8 deletions
  1. 8 0
      main/css/base.css
  2. 1 1
      main/exercice/exercise.lib.php
  3. 4 7
      main/exercice/exercise_submit.php

+ 8 - 0
main/css/base.css

@@ -5137,3 +5137,11 @@ i.size-32.icon-new-work {
 #learning_path_left_zone .no-border {
     border: 0px;
 }
+
+.highlight_image_selected img {
+    border: 5px solid #0088cc;
+}
+
+.highlight_image_default img {
+    border: 5px solid transparent;
+}

+ 1 - 1
main/exercice/exercise.lib.php

@@ -228,7 +228,7 @@ function showQuestion($questionId, $only_questions = false, $origin = false, $cu
                 $answer_input = null;
                 if ($answerType == UNIQUE_ANSWER_IMAGE) {
                     $attributes['style'] = 'display:none';
-                    $answer_input .= '<div id="answer'.$questionId.$numAnswer.'" style="float:left" class="highlight_image">';
+                    $answer_input .= '<div id="answer'.$questionId.$numAnswer.'" style="float:left" class="highlight_image_default highlight_image">';
                 }
 
                 $answer_input .= '<label class="radio">';

+ 4 - 7
main/exercice/exercise_submit.php

@@ -210,15 +210,12 @@ jsPlumb.ready(function() {
 $(function(){
     $(".highlight_image").on("click", function() {
         $(this).parent().find(".highlight_image").each(function(index){
-            $(this).find("img").css({
-                "border" :"none"
-            });
+            $(this).removeClass("highlight_image_selected");
+            $(this).addClass("highlight_image_default");
             $(this).find("label").find("input").attr("checked", false);
         });
-
-        $(this).find("label").find("img").css({
-            "border": "5px solid #f00"
-        });
+        $(this).removeClass("highlight_image_default");
+        $(this).addClass("highlight_image_selected");
         $(this).find("label").find("input").attr("checked", "checked");
 
     });