2014-01-16 10:15:00 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
$(".select_user_modal").on('click', function(){
|
|
|
|
var ids = [];
|
2014-03-07 07:15:52 +00:00
|
|
|
var users = $(this).siblings('.selected_users').children('span.selected_user');
|
2014-01-16 10:15:00 +00:00
|
|
|
users.each(function(i) {
|
|
|
|
ids.push(users.eq(i).attr('id'));
|
|
|
|
});
|
|
|
|
$("#main-wrap").after("<span id='select_user'></span>");
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: $(this).attr("rel"),
|
|
|
|
dataType: 'script',
|
2014-03-07 07:15:52 +00:00
|
|
|
data: {field: $(this).attr("field"), ids: ids},
|
2014-01-16 10:15:00 +00:00
|
|
|
success: function (msg) {
|
|
|
|
$("#member-filter").modal('show'); },
|
|
|
|
error: function(){
|
|
|
|
alert("ERROR");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
2014-03-07 07:15:52 +00:00
|
|
|
|
|
|
|
$(document).on('click', ".remove_user", function(){
|
|
|
|
$(this).parent().remove();
|
|
|
|
});
|
|
|
|
|
2014-01-16 10:15:00 +00:00
|
|
|
$("#remove_users").on('click', function(){
|
|
|
|
var ids = [];
|
|
|
|
var users = $('.selected_user input[type="checkbox"]:checked');
|
|
|
|
users.each(function(i) {
|
|
|
|
ids.push(users.eq(i).parent().attr('id'));
|
|
|
|
});
|
|
|
|
if (users.size() > 0) {
|
|
|
|
// TODO: i18n in javascript
|
|
|
|
if (confirm('Are you sure you want to delete this?')) {
|
|
|
|
$.ajax({
|
|
|
|
type: 'DELETE',
|
|
|
|
url: $(this).attr("rel"),
|
|
|
|
dataType: 'script',
|
|
|
|
data: {ids: ids},
|
|
|
|
error: function(){
|
|
|
|
// TODO: i18n in javascript
|
|
|
|
alert("ERROR");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// TODO: i18n in javascript
|
|
|
|
alert('You did not select anything to delete')
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|