Skip to content

Instantly share code, notes, and snippets.

@jakecraige
Created December 4, 2013 22:26
Show Gist options
  • Save jakecraige/7796732 to your computer and use it in GitHub Desktop.
Save jakecraige/7796732 to your computer and use it in GitHub Desktop.
module.directive 'selectallgroup', ->
restrict: 'A'
link: (scope, ele, attrs)->
$(ele).on 'change', ->
$(@).parents('h3').next('ul').find('input[type=checkbox]').each ()->
unless $(@).is(':disabled')
selectAllChecked = $(ele).prop('checked')
if selectAllChecked
$(@).prop('checked', false)
else
$(@).prop('checked', true)
$(@).click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment