added an option to remove a contact from the last aspect, after a prompt
This commit is contained in:
parent
acd55cf7d6
commit
1da965616b
5 changed files with 53 additions and 23 deletions
|
|
@ -7,7 +7,7 @@
|
|||
= search_field_tag :contact_search, "", :class => 'contact_list_search', :results => 5, :placeholder => t('.all_contacts')
|
||||
%ul
|
||||
- for contact in contacts
|
||||
%li
|
||||
%li{:data=>{:guid=>contact.person.id}}
|
||||
= person_image_tag contact.person
|
||||
%h4.name
|
||||
= link_to contact.person.name, contact.person
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ And /^I preemptively confirm the alert$/ do
|
|||
a = page.evaluate_script("window.confirm = function() { return true; }")
|
||||
end
|
||||
|
||||
And /^I preemptively reject the alert$/ do
|
||||
a = page.evaluate_script("window.confirm = function() { return false; }")
|
||||
end
|
||||
|
||||
When /^(.*) in the modal window$/ do |action|
|
||||
within('#facebox') do
|
||||
When action
|
||||
|
|
|
|||
|
|
@ -57,6 +57,13 @@ Then /^I should see (\d+) contact(?:s)? in "([^"]*)"$/ do |contact_count, aspect
|
|||
number_of_contacts.should == contact_count.to_i
|
||||
end
|
||||
|
||||
Then /^I should see no contact(?:s)? in "([^"]*)"$/ do |aspect_name|
|
||||
aspect = @me.reload.aspects.find_by_name(aspect_name)
|
||||
number_of_contacts = evaluate_script(
|
||||
"$('ul.dropzone.ui-droppable[data-aspect_id=\"#{aspect.id}\"]').children('li.person').length")
|
||||
number_of_contacts.should == 0
|
||||
end
|
||||
|
||||
When /^I drag the contact request to the "([^"]*)" aspect$/ do |aspect_name|
|
||||
Given "I have turned off jQuery effects"
|
||||
aspect = @me.reload.aspects.find_by_name(aspect_name)
|
||||
|
|
@ -90,3 +97,10 @@ Then /^I should have aspect "([^"]*)" "([^"]*)"$/ do |arg1, arg2|
|
|||
end
|
||||
end
|
||||
|
||||
Given /^a user with email "([^"]*)" is connected with "([^"]*)"$/ do |arg1, arg2|
|
||||
user1 = User.where(:email => arg1).first
|
||||
user2 = User.where(:email => arg2).first
|
||||
connect_users(user1, user1.aspects.first, user2, user2.aspects.first)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
var List = {
|
||||
initialize: function() {
|
||||
$(".contact_list_search").live("keyup", function(e) {
|
||||
|
|
@ -23,9 +21,20 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
disconnectUser: function(person_id){
|
||||
$.ajax({
|
||||
url: "/people/" + person_id,
|
||||
type: "DELETE",
|
||||
success: function(){
|
||||
$('.contact_list li[data-guid='+person_id+']').fadeOut(200);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.added').live('ajax:loading', function() {
|
||||
$(this).fadeTo(200,0.4);
|
||||
});
|
||||
|
|
@ -46,7 +55,9 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$('.added').live('ajax:failure', function(data, html, xhr) {
|
||||
alert(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"));
|
||||
};
|
||||
$(this).fadeTo(200,1);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ src_files:
|
|||
- public/javascripts/mobile.js
|
||||
- public/javascripts/aspect-edit.js
|
||||
- public/javascripts/aspect-contacts.js
|
||||
- public/javascripts/contact-list.js
|
||||
- public/javascripts/web-socket-receiver.js
|
||||
- public/javascripts/view.js
|
||||
- public/javascripts/publisher.js
|
||||
|
|
|
|||
Loading…
Reference in a new issue