Dunlop.register_setup 'collapsible', (target)->
  collapsible_containers = target.find('.collapsible-container')
  collapsible_containers.each (i, el) ->
    $(el).children('.collapsible-title').click -> $(el).toggleClass('collapsed')

  target.find('.collapsible-expand-all').dblclick ->
    if $(@).hasClass('opened')
      collapsible_containers.addClass('collapsed')
      $(@).removeClass('opened')
    else
      collapsible_containers.removeClass('collapsed')
      $(@).addClass('opened')
