$placeholder.after($added)
if not $placeholder.hasClass('multiple')
$placeholder.hide()
+ if $added.is(".add-li")
+ $added.wrap("<li/>")
+
$added.append('<span class="remove">x</span>')
$('.remove', $added).click (ev) =>
- $added.prev(".placeholder:not(.multiple)").show()
if not ismultiple
$($added.data('original')).removeClass('disabled').draggable('enable')
+
+ if $added.is(".add-li")
+ $added = $added.closest('li')
+ $added.prev(".placeholder:not(.multiple)").show()
$added.remove()
+
## XXX co z issortable?
dragging: (ismultiple, issortable) ->
$(".question", @element).each (i, question) =>
else
should_be_checked = solution.indexOf(piece_no) >= 0
console.log("check " + $("input[type=checkbox]", qpiece).attr("id") + " -> " + should_be_checked)
- $("input[type=checkbox]", qpiece).prop 'checked', should_be_checked
+ $("input[type=checkbox],input[type=radio]", qpiece).prop 'checked', should_be_checked
return [good, all]
show_solutions: ->
- reset()
+ @reset()
for qp in $(".question-piece", @element)
- if $(qp).data('solution') == 'true'
+ if $(qp).data('solution') == true
$(".true", qp).click()
else
$(".false", qp).click()
new EduModule($("#book-text"))
$(".exercise").each (i, el) ->
- exercise(this)
\ No newline at end of file
+ exercise(this)