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},
|
||||
:remote => true,
|
||||
:method => 'post',
|
||||
:class => 'add button'
|
||||
:class => 'add button',
|
||||
'data-aspect_id' => aspect_id,
|
||||
'data-person_id' => person_id
|
||||
end
|
||||
|
||||
def remove_from_aspect_button(aspect_id, person_id)
|
||||
|
|
@ -35,7 +37,9 @@ module AspectsHelper
|
|||
:person_id => person_id},
|
||||
:remote => true,
|
||||
:method => 'delete',
|
||||
:class => 'added button'
|
||||
:class => 'added button',
|
||||
'data-aspect_id' => aspect_id,
|
||||
'data-person_id' => person_id
|
||||
end
|
||||
|
||||
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') ) {
|
||||
$("#no_contacts").fadeOut(200);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,4 @@
|
|||
var element = $(".added", "li[data-guid=<%= @aspect.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();
|
||||
var element = $(".added[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]");
|
||||
element.parent().html("<%= escape_javascript(render('aspect_memberships/remove_from_aspect', :aspect => @aspect, :person => @contact.person, :contact => @contact)) %>");
|
||||
element.fadeTo(200,1);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,13 @@
|
|||
%ul.dropdown_list
|
||||
- for aspect in @all_aspects
|
||||
%li{:data => {:aspect_id => aspect.id}}
|
||||
= check_box_tag "yo"
|
||||
= check_box_tag "yo", "hey", aspect.contacts.include?(contact)
|
||||
= aspect.name
|
||||
|
||||
.hidden
|
||||
= aspect_membership_button(aspect, contact, contact.person)
|
||||
|
||||
|
||||
%br
|
||||
%div{:style => "text-align:right;"}
|
||||
= 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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
Given /^I have (\d) contacts?$/ do |count|
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
var checkbox = li.find('input[type=checkbox]');
|
||||
toggleCheckbox(checkbox);
|
||||
|
||||
$.fn.callRemote.apply(li.find(".button"));
|
||||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue