collapsable comments on proposals/debates

This commit is contained in:
Juanjo Bazán
2016-02-10 19:09:44 +01:00
committed by Juanjo Bazán
parent 22e5ba344a
commit 3bd767e36f
4 changed files with 74 additions and 1 deletions

View File

@@ -29,6 +29,13 @@ App.Comments =
toggle_form: (id) ->
$("#js-comment-form-#{id}").toggle()
toggle_arrow: (id) ->
arrow = "i##{id}_arrow"
if $(arrow).hasClass("icon-angle-right")
$(arrow).removeClass("icon-angle-right").addClass("icon-angle-down")
else
$(arrow).removeClass("icon-angle-down").addClass("icon-angle-right")
initialize: ->
$('body .js-add-comment-link').each ->
$this = $(this)
@@ -39,3 +46,11 @@ App.Comments =
App.Comments.toggle_form(id)
false
).data 'initialized', 'yes'
$('body .js-toggle-children').each ->
$(this).on('click', ->
children_container_id = "#{$(this).data().id}_children"
$("##{children_container_id}").toggle('slow')
App.Comments.toggle_arrow(children_container_id)
false
)