diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index b6f7124f8a6ee766f753f5143e2c1235e5777f99..2554d5c7b67d73c23058609bda118a2b5ecc0670 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -12,8 +12,11 @@ class AspectsController < ApplicationController def index if params[:a_ids] @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 @aspects = current_user.aspects.includes(:contacts => {:person => :profile}) + @selected_contacts = current_user.contacts end # redirect to signup @@ -119,7 +122,7 @@ class AspectsController < ApplicationController def update @aspect = current_user.aspects.where(:id => params[:id]).first - + if @aspect.update_attributes!( params[:aspect] ) #hack, we don't know why mass assignment is not working @aspect.contacts_visible = params[:aspect][:contacts_visible] diff --git a/app/views/aspects/_aspect_listings.haml b/app/views/aspects/_aspect_listings.haml index ec22aa4ef12873c9cccee32df2daa112428402de..a5ffe04da5d066e7d1a4ed0823ffa890db426b0e 100644 --- a/app/views/aspects/_aspect_listings.haml +++ b/app/views/aspects/_aspect_listings.haml @@ -2,6 +2,7 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. += hidden_field_tag :contact_json, @selected_contacts.map{|contact| contact.person}.to_json %h4 .right diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index c9b35853496d92c0a15385027cd4ce83633f65ee..0b15cd10de01bd27676aca001a53a0e1bdb7bdf7 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -6,7 +6,6 @@ - content_for :head do = include_javascripts :home -= hidden_field_tag :contact_json, @contacts.map{|contact| contact.person}.to_json .span-15.append-2 = render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count