fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
and some more fixes
[redakcja.git]
/
redakcja
/
static
/
edumed
/
js
/
edumed.coffee
diff --git
a/redakcja/static/edumed/js/edumed.coffee
b/redakcja/static/edumed/js/edumed.coffee
index
e65faaa
..
14c700c
100644
(file)
--- a/
redakcja/static/edumed/js/edumed.coffee
+++ b/
redakcja/static/edumed/js/edumed.coffee
@@
-17,22
+17,29
@@
class EduModule extends Binding
# $(".teacher", @element).removeClass "show"
# $(".teacher", @element).removeClass "show"
-class Ex
c
ercise extends Binding
+class Exercise extends Binding
constructor: (element) ->
constructor: (element) ->
- super 'ex
c
ercise', element
- # just save the html to reset the ex
c
ercise
- $(@element).data("ex
c
ercise-html", $(@element).html())
+ super 'exercise', element
+ # just save the html to reset the exercise
+ $(@element).data("exercise-html", $(@element).html())
- $(".check", @element).click =>
+ $(".check", @element).click
(ev)
=>
@check()
@check()
+ $(ev.target).next(".retry").show()
+ $(ev.target).hide()
+ $(".retry", @element).click (ev) =>
+ $(".correct, .incorrect", @element).removeClass("correct incorrect")
+ $(ev.target).prev(".check").show()
+ $(ev.target).hide()
$('.solutions', @element).click =>
@show_solutions()
$('.solutions', @element).click =>
@show_solutions()
+ $(".comment", @element).show()
$('.reset', @element).click =>
@reset()
reset: ->
$('.reset', @element).click =>
@reset()
reset: ->
- $(@element).html($(@element).data('ex
c
ercise-html'))
- ex
c
ercise @element
+ $(@element).html($(@element).data('exercise-html'))
+ exercise @element
piece_correct: (qpiece) ->
$(qpiece).removeClass('incorrect').addClass('correct')
piece_correct: (qpiece) ->
$(qpiece).removeClass('incorrect').addClass('correct')
@@
-171,7
+178,7
@@
class Excercise extends Binding
-class Wybor extends Ex
c
ercise
+class Wybor extends Exercise
constructor: (element) ->
super element
constructor: (element) ->
super element
@@
-217,7
+224,7
@@
class Wybor extends Excercise
-class Uporzadkuj extends Ex
c
ercise
+class Uporzadkuj extends Exercise
constructor: (element) ->
super element
$('ol, ul', @element).sortable({ items: "> li" })
constructor: (element) ->
super element
$('ol, ul', @element).sortable({ items: "> li" })
@@
-256,7
+263,7
@@
class Uporzadkuj extends Excercise
# XXX propozycje="1/0"
# XXX propozycje="1/0"
-class Luki extends Ex
c
ercise
+class Luki extends Exercise
constructor: (element) ->
super element
@dragging false, false
constructor: (element) ->
super element
@dragging false, false
@@
-281,7
+288,7
@@
class Luki extends Excercise
@draggable_move $qp, $(placeholder), false
@draggable_move $qp, $(placeholder), false
-class Zastap extends Ex
c
ercise
+class Zastap extends Exercise
constructor: (element) ->
super element
$(".paragraph", @element).each (i, par) =>
constructor: (element) ->
super element
$(".paragraph", @element).each (i, par) =>
@@
-347,7
+354,7
@@
class Zastap extends Excercise
$(chld).remove()
$(chld).remove()
-class Przyporzadkuj extends Ex
c
ercise
+class Przyporzadkuj extends Exercise
is_multiple: ->
for qp in $(".question-piece", @element)
if $(qp).data('solution').split(/[ ,]+/).length > 1
is_multiple: ->
for qp in $(".question-piece", @element)
if $(qp).data('solution').split(/[ ,]+/).length > 1
@@
-410,7
+417,7
@@
class Przyporzadkuj extends Excercise
-class PrawdaFalsz extends Ex
c
ercise
+class PrawdaFalsz extends Exercise
constructor: (element) ->
super element
constructor: (element) ->
super element
@@
-450,7
+457,7
@@
class PrawdaFalsz extends Excercise
##########
##########
-ex
c
ercise = (ele) ->
+exercise = (ele) ->
es =
wybor: Wybor
uporzadkuj: Uporzadkuj
es =
wybor: Wybor
uporzadkuj: Uporzadkuj
@@
-473,5
+480,5
@@
window.edumed =
$(document).ready () ->
new EduModule($("#book-text"))
$(document).ready () ->
new EduModule($("#book-text"))
- $(".ex
c
ercise").each (i, el) ->
- ex
c
ercise(this)
\ No newline at end of file
+ $(".exercise").each (i, el) ->
+ exercise(this)
\ No newline at end of file