Skip to content

Instantly share code, notes, and snippets.

@Ruxton
Forked from dangalipo/groups.coffee
Created May 2, 2012 08:11
Show Gist options
  • Save Ruxton/2574975 to your computer and use it in GitHub Desktop.
Save Ruxton/2574975 to your computer and use it in GitHub Desktop.
jQuery ($) ->
$('#add-user').on 'click', (e) ->
userId = $('#group_user_id').val()
groupId = $('#group_id').val()
data =
group_id : groupId
user_id : userId
$.post "/admin/group_users", data, (data)->
if data == "error"
alert("Could not add user")
else
$('#users-list').append(data)
console.log('Setting up user remove listener')
$('#users-list .user').on 'click', (e) ->
alert("foo")
console.log $(e.target).parent()
$(e.target).parent().remove()
console.log('user remove listener setup')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment