can remote the person from the last aspect from edit contact pane
This commit is contained in:
parent
fcad60d908
commit
9f239789b9
3 changed files with 33 additions and 11 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
.aspect_list#aspects_list
|
.aspect_list#aspects_list{:data=>{:person_id=>person.id}}
|
||||||
%ul
|
%ul
|
||||||
- for aspect in aspects_with_person
|
- for aspect in aspects_with_person
|
||||||
= render :partial => 'aspects/aspect_list_item',
|
= render :partial => 'aspects/aspect_list_item',
|
||||||
|
|
|
||||||
|
|
@ -13,26 +13,35 @@ Feature: disconnecting users
|
||||||
Then I should see 1 contact in "Besties"
|
Then I should see 1 contact in "Besties"
|
||||||
|
|
||||||
|
|
||||||
Scenario: remove contact from the contact show page
|
Scenario Outline: remove contact from the contact show page
|
||||||
When I am on "alice@alice.alice"'s page
|
When I am on "alice@alice.alice"'s page
|
||||||
And I follow "edit aspect membership"
|
And I follow "edit aspect membership"
|
||||||
And I preemptively confirm the alert
|
And I preemptively <accept> the alert
|
||||||
And I follow "remove contact" in the modal window
|
And I follow "remove contact" in the modal window
|
||||||
|
|
||||||
And I wait for the ajax to finish
|
And I wait for the ajax to finish
|
||||||
And I am on the aspects manage page
|
And I am on the aspects manage page
|
||||||
Then I should see no contacts in "Besties"
|
Then I should see <contacts> in "Besties"
|
||||||
|
|
||||||
|
Examples:
|
||||||
Scenario: cancel removing contact from the contact show page
|
| accept | contacts |
|
||||||
|
| confirm | no contacts |
|
||||||
|
| reject | 1 contact |
|
||||||
|
|
||||||
|
Scenario Outline: remove last contact from the contact show page
|
||||||
When I am on "alice@alice.alice"'s page
|
When I am on "alice@alice.alice"'s page
|
||||||
And I follow "edit aspect membership"
|
And I follow "edit aspect membership"
|
||||||
And I preemptively reject the alert
|
And I preemptively <accept> the alert
|
||||||
And I follow "remove contact" in the modal window
|
And I press the first ".added" within "#facebox #aspects_list ul > li:first-child"
|
||||||
|
|
||||||
And I wait for the ajax to finish
|
And I wait for the ajax to finish
|
||||||
And I am on the aspects manage page
|
And I am on the aspects manage page
|
||||||
Then I should see 1 contact in "Besties"
|
Then I should see <contacts> in "Besties"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| accept | contacts |
|
||||||
|
| confirm | no contacts |
|
||||||
|
| reject | 1 contact |
|
||||||
|
|
||||||
Scenario: remove contact from the aspect edit page
|
Scenario: remove contact from the aspect edit page
|
||||||
When I go to the home page
|
When I go to the home page
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,11 @@ var List = {
|
||||||
url: "/people/" + person_id,
|
url: "/people/" + person_id,
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
success: function(){
|
success: function(){
|
||||||
$('.contact_list li[data-guid='+person_id+']').fadeOut(200);
|
if( $('.contact_list').length == 1){
|
||||||
|
$('.contact_list li[data-guid='+person_id+']').fadeOut(200);
|
||||||
|
} else if($('#aspects_list').length == 1) {
|
||||||
|
$.facebox.close();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +60,16 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$('.added').live('ajax:failure', function(data, html, xhr) {
|
$('.added').live('ajax:failure', function(data, html, xhr) {
|
||||||
if(confirm(Diaspora.widgets.i18n.t('shared.contact_list.cannot_remove'))){
|
if(confirm(Diaspora.widgets.i18n.t('shared.contact_list.cannot_remove'))){
|
||||||
List.disconnectUser($(this).parents('li').attr("data-guid"));
|
var person_id;
|
||||||
|
|
||||||
|
if( $('.contact_list').length == 1){
|
||||||
|
person_id = $(this).parents('li').attr("data-guid");
|
||||||
|
$('.contact_list li[data-guid='+person_id+']').fadeOut(200);
|
||||||
|
} else if($('#aspects_list').length == 1) {
|
||||||
|
person_id = $(this).parents('#aspects_list').attr("data-person_id");
|
||||||
|
};
|
||||||
|
|
||||||
|
List.disconnectUser(person_id);
|
||||||
};
|
};
|
||||||
$(this).fadeTo(200,1);
|
$(this).fadeTo(200,1);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue