From: Radek Czajka Date: Tue, 12 Feb 2013 08:56:48 +0000 (+0100) Subject: exercises styling, script from upstream X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/15f8a17d42b8413959e6b0d6b716bac8aca244d4 exercises styling, script from upstream --- diff --git a/catalogue/static/catalogue/css/exercise.css b/catalogue/static/catalogue/css/exercise.css index 3325f90..2be22bc 100644 --- a/catalogue/static/catalogue/css/exercise.css +++ b/catalogue/static/catalogue/css/exercise.css @@ -109,6 +109,10 @@ cursor: pointer; z-index: 2; width: 38.625em; } +.przyporzadkuj span.question-piece { + display: inline-block; + margin: .1em; + width: auto; } .przyporzadkuj .question-piece.disabled { background-color: #eee; color: #d4d6d8; } diff --git a/catalogue/static/catalogue/css/exercise.scss b/catalogue/static/catalogue/css/exercise.scss index cf7bfc3..e16d7d7 100755 --- a/catalogue/static/catalogue/css/exercise.scss +++ b/catalogue/static/catalogue/css/exercise.scss @@ -162,6 +162,11 @@ $px: 0.0625em; @include bubble-drag; width: 618*$px; } + span.question-piece { + display: inline-block; + margin: .1em; + width: auto; + } .question-piece.disabled { @include bubble-drag-disabled; } diff --git a/catalogue/static/catalogue/js/edumed.js b/catalogue/static/catalogue/js/edumed.js index f11ac36..33b7c58 100644 --- a/catalogue/static/catalogue/js/edumed.js +++ b/catalogue/static/catalogue/js/edumed.js @@ -152,12 +152,18 @@ if (!$placeholder.hasClass('multiple')) { $placeholder.hide(); } - $added.append('x
'); + if ($added.is(".add-li")) { + $added.wrap("
  • "); + } + $added.append('x
    '); return $('.remove', $added).click(function(ev) { - $added.prev(".placeholder:not(.multiple)").show(); if (!ismultiple) { $($added.data('original')).removeClass('disabled').draggable('enable'); } + if ($added.is(".add-li")) { + $added = $added.closest('li'); + } + $added.prev(".placeholder:not(.multiple)").show(); return $added.remove(); }); }; @@ -263,7 +269,7 @@ should_be_checked = solution.indexOf(piece_no) >= 0; } console.log("check " + $("input[type=checkbox]", qpiece).attr("id") + " -> " + should_be_checked); - return $("input[type=checkbox]", qpiece).prop('checked', should_be_checked); + return $("input[type=checkbox],input[type=radio]", qpiece).prop('checked', should_be_checked); }); }; @@ -598,12 +604,12 @@ PrawdaFalsz.prototype.show_solutions = function() { var qp, _i, _len, _ref, _results; - reset(); + this.reset(); _ref = $(".question-piece", this.element); _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { qp = _ref[_i]; - if ($(qp).data('solution') === 'true') { + if ($(qp).data('solution') === true) { _results.push($(".true", qp).click()); } else { _results.push($(".false", qp).click());