Skip to content
Extraits de code Groupes Projets
Valider 056bebd4 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

Autocompletion contacts now change with changing aspect selection

parent c11ffe93
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -12,8 +12,11 @@ class AspectsController < ApplicationController ...@@ -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
...@@ -119,7 +122,7 @@ class AspectsController < ApplicationController ...@@ -119,7 +122,7 @@ class AspectsController < ApplicationController
def update def update
@aspect = current_user.aspects.where(:id => params[:id]).first @aspect = current_user.aspects.where(:id => params[:id]).first
if @aspect.update_attributes!( params[:aspect] ) if @aspect.update_attributes!( params[:aspect] )
#hack, we don't know why mass assignment is not working #hack, we don't know why mass assignment is not working
@aspect.contacts_visible = params[:aspect][:contacts_visible] @aspect.contacts_visible = params[:aspect][:contacts_visible]
......
...@@ -2,6 +2,7 @@ ...@@ -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 @@ ...@@ -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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter