Autocompletion contacts now change with changing aspect selection
This commit is contained in:
parent
c11ffe93c0
commit
056bebd4f4
3 changed files with 5 additions and 2 deletions
|
|
@ -12,8 +12,11 @@ class AspectsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
if params[:a_ids]
|
if params[:a_ids]
|
||||||
@aspects = current_user.aspects.where(:id => params[:a_ids]).includes(:contacts => {:person => :profile})
|
@aspects = current_user.aspects.where(:id => params[:a_ids]).includes(:contacts => {:person => :profile})
|
||||||
|
@selected_contacts = @aspects.inject([]){|arr, aspect| arr.concat(aspect.contacts)}
|
||||||
|
@selected_contacts.uniq!
|
||||||
else
|
else
|
||||||
@aspects = current_user.aspects.includes(:contacts => {:person => :profile})
|
@aspects = current_user.aspects.includes(:contacts => {:person => :profile})
|
||||||
|
@selected_contacts = current_user.contacts
|
||||||
end
|
end
|
||||||
|
|
||||||
# redirect to signup
|
# redirect to signup
|
||||||
|
|
|
||||||
|
|
@ -2,6 +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.
|
||||||
|
|
||||||
|
= hidden_field_tag :contact_json, @selected_contacts.map{|contact| contact.person}.to_json
|
||||||
|
|
||||||
%h4
|
%h4
|
||||||
.right
|
.right
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
- content_for :head do
|
- content_for :head do
|
||||||
= include_javascripts :home
|
= include_javascripts :home
|
||||||
|
|
||||||
= hidden_field_tag :contact_json, @contacts.map{|contact| contact.person}.to_json
|
|
||||||
|
|
||||||
.span-15.append-2
|
.span-15.append-2
|
||||||
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
|
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue