dropdown in ContactsController#sharing now works
This commit is contained in:
parent
9f3044838d
commit
c67d143719
7 changed files with 19 additions and 15 deletions
|
|
@ -23,7 +23,9 @@ module AspectsHelper
|
||||||
:person_id => person_id},
|
:person_id => person_id},
|
||||||
:remote => true,
|
:remote => true,
|
||||||
:method => 'post',
|
:method => 'post',
|
||||||
:class => 'add button'
|
:class => 'add button',
|
||||||
|
'data-aspect_id' => aspect_id,
|
||||||
|
'data-person_id' => person_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_from_aspect_button(aspect_id, person_id)
|
def remove_from_aspect_button(aspect_id, person_id)
|
||||||
|
|
@ -35,7 +37,9 @@ module AspectsHelper
|
||||||
:person_id => person_id},
|
:person_id => person_id},
|
||||||
:remote => true,
|
:remote => true,
|
||||||
:method => 'delete',
|
:method => 'delete',
|
||||||
:class => 'added button'
|
:class => 'added button',
|
||||||
|
'data-aspect_id' => aspect_id,
|
||||||
|
'data-person_id' => person_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def aspect_membership_button(aspect, contact, person)
|
def aspect_membership_button(aspect, contact, person)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
var element = $(".add", "li[data-guid=<%= @aspect.id %>]");
|
var element = $(".add[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]");
|
||||||
|
|
||||||
if( $("#no_contacts").is(':visible') ) {
|
if( $("#no_contacts").is(':visible') ) {
|
||||||
$("#no_contacts").fadeOut(200);
|
$("#no_contacts").fadeOut(200);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,4 @@
|
||||||
var element = $(".added", "li[data-guid=<%= @aspect.id %>]"),
|
var element = $(".added[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]");
|
||||||
contactPictures = $(".contact_pictures");
|
|
||||||
|
|
||||||
if( contactPictures.length > 0 ) {
|
|
||||||
if( contactPictures[0].childElementCount == 0 ) {
|
|
||||||
$("#no_contacts").fadeIn(200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$("a[data-guid=<%= @aspect_id %>]", ".aspects").parent().remove();
|
|
||||||
element.parent().html("<%= escape_javascript(render('aspect_memberships/remove_from_aspect', :aspect => @aspect, :person => @contact.person, :contact => @contact)) %>");
|
element.parent().html("<%= escape_javascript(render('aspect_memberships/remove_from_aspect', :aspect => @aspect, :person => @contact.person, :contact => @contact)) %>");
|
||||||
element.fadeTo(200,1);
|
element.fadeTo(200,1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,13 @@
|
||||||
%ul.dropdown_list
|
%ul.dropdown_list
|
||||||
- for aspect in @all_aspects
|
- for aspect in @all_aspects
|
||||||
%li{:data => {:aspect_id => aspect.id}}
|
%li{:data => {:aspect_id => aspect.id}}
|
||||||
= check_box_tag "yo"
|
= check_box_tag "yo", "hey", aspect.contacts.include?(contact)
|
||||||
= aspect.name
|
= aspect.name
|
||||||
|
|
||||||
|
.hidden
|
||||||
|
= aspect_membership_button(aspect, contact, contact.person)
|
||||||
|
|
||||||
|
|
||||||
%br
|
%br
|
||||||
%div{:style => "text-align:right;"}
|
%div{:style => "text-align:right;"}
|
||||||
= link_to t('aspects.edit.done'), '#', :class => 'button', :rel => 'close'
|
= link_to t('aspects.edit.done'), '#', :class => 'button', :rel => 'close'
|
||||||
|
|
|
||||||
|
|
@ -33,3 +33,7 @@ Feature: User manages aspects
|
||||||
And I wait for the ajax to finish
|
And I wait for the ajax to finish
|
||||||
Then I should have 1 contact in "Cat People"
|
Then I should have 1 contact in "Cat People"
|
||||||
|
|
||||||
|
When I press the 2nd "li" within ".dropdown.active .dropdown_list"
|
||||||
|
And I wait for the ajax to finish
|
||||||
|
Then I should have 0 contacts in "Cat People"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ Given /^many posts from alice for bob$/ do
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should have (\d) contacts? in "([^"]*)"$/ do |n_contacts, aspect_name|
|
Then /^I should have (\d) contacts? in "([^"]*)"$/ do |n_contacts, aspect_name|
|
||||||
@me.aspects.where(:name => aspect_name).first.contacts.size.should == n_contacts.to_i
|
@me.aspects.where(:name => aspect_name).first.contacts.count.should == n_contacts.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I have (\d) contacts?$/ do |count|
|
Given /^I have (\d) contacts?$/ do |count|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
var checkbox = li.find('input[type=checkbox]');
|
var checkbox = li.find('input[type=checkbox]');
|
||||||
toggleCheckbox(checkbox);
|
toggleCheckbox(checkbox);
|
||||||
|
|
||||||
|
$.fn.callRemote.apply(li.find(".button"));
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue