Skip to content

Instantly share code, notes, and snippets.

@dangalipo
Created May 2, 2012 08:08
Show Gist options
  • Save dangalipo/2574963 to your computer and use it in GitHub Desktop.
Save dangalipo/2574963 to your computer and use it in GitHub Desktop.
group =
setup: ->
@addUser()
@removeUser()
addUser: ->
$('#add-user').click =>
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)
removeUser: ->
$('#users-list .user').click =>
alert("foo")
console.log $(e.target).parent()
$(e.target).parent().remove()
$(document).ready ->
group.setup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment