Skip to content

Commit

Permalink
Fix a bug on folding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Sep 26, 2011
1 parent f7c94f4 commit 195a031
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions app/assets/javascripts/toolbar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,21 @@
items = $(@options.folding)
items.find(".folding").remove()
for i in items
item = $(i)
score = parseInt(item.find(".score:first").text(), 10)
link = item.children("h2").prepend('<a href="#" class="folding" title="Plier">[-]</a>').children(".folding")
fold = (b) ->
if b
item.addClass "fold"
link.text("[+]").attr "title", "Déplier"
else
item.removeClass "fold"
link.text("[-]").attr "title", "Plier"
link.click ->
fold link.text() == "[-]"
false
fold score < @threshold
do (i) ->
item = $(i)
score = parseInt(item.find(".score:first").text(), 10)
link = item.children("h2").prepend('<a href="#" class="folding" title="Plier">[-]</a>').children(".folding")
fold = (b) ->
if b
item.addClass "fold"
link.text("[+]").attr "title", "Déplier"
else
item.removeClass "fold"
link.text("[-]").attr "title", "Plier"
link.click ->
fold link.text() == "[-]"
false
fold score < @threshold

Toolbar.defaultOptions =
folding: null
Expand Down

0 comments on commit 195a031

Please sign in to comment.