throws an alert if you try to remove person from the last aspect
This commit is contained in:
parent
bec1842bed
commit
30bae4f807
2 changed files with 22 additions and 14 deletions
|
|
@ -60,7 +60,7 @@
|
||||||
-else
|
-else
|
||||||
-for person in aspect.people
|
-for person in aspect.people
|
||||||
|
|
||||||
%li.person{:id => person.id, :from_aspect_id => aspect.id}
|
%li.person{:id => person.id, :class => person.id, :from_aspect_id => aspect.id}
|
||||||
= person_image_tag(person)
|
= person_image_tag(person)
|
||||||
.name
|
.name
|
||||||
= link_to person.real_name, person
|
= link_to person.real_name, person
|
||||||
|
|
|
||||||
|
|
@ -89,14 +89,17 @@ $(function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(ui.draggable[0]).fadeOut('slow'); // ui.draggable.fadeOut('slow')
|
$(ui.draggable[0]).fadeOut('slow');
|
||||||
|
$(ui.draggable[0]).remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".aspect_remove ul").droppable({
|
$(".aspect_remove ul").droppable({
|
||||||
hoverClass: 'active',
|
hoverClass: 'active',
|
||||||
drop: function(event, ui) {
|
drop: function(event, ui) {
|
||||||
|
if ($( "." + ui.draggable[0].id).length == 1) {
|
||||||
|
alert("You can not remove the person from the last aspect");
|
||||||
|
} else {
|
||||||
if (!$(ui.draggable[0]).hasClass('requested_person')){
|
if (!$(ui.draggable[0]).hasClass('requested_person')){
|
||||||
var aspect = ui.draggable[0].getAttribute('from_aspect_id')
|
var aspect = ui.draggable[0].getAttribute('from_aspect_id')
|
||||||
var person_id = ui.draggable[0].id
|
var person_id = ui.draggable[0].id
|
||||||
|
|
@ -109,8 +112,13 @@ $(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
$(ui.draggable[0]).fadeOut('slow');
|
||||||
|
$(ui.draggable[0]).remove();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$(ui.draggable[0]).fadeOut('slow'); // ui.draggable.fadeOut('slow')
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue