Orbit/app/assets/javascripts/member-selection.js

25 lines
739 B
JavaScript

$(document).ready(function() {
$(".select_user_modal").on('click', function(){
var ids = [];
var users = $(this).siblings('#selected_users').children('span.selected_user');
users.each(function(i) {
ids.push(users.eq(i).attr('user_id'));
});
$("#main-wrap").after("<span id='select_user'></span>");
$.ajax({
type: 'GET',
url: $(this).attr("rel"),
dataType: 'script',
data: {field: $(this).attr("field"), ids: ids},
success: function (msg) {
$("#select_user_modal").modal('show'); },
error: function(){
alert("ERROR");
}
});
return false;
});
$(document).on('click', ".remove_user", function(){
$(this).parent().remove();
});
});