visible contacts option on aspect edit pane

This commit is contained in:
zhitomirskiyi 2011-01-27 13:37:00 -08:00
parent 94ae7a678b
commit dcf6469ded
4 changed files with 16 additions and 7 deletions

View file

@ -101,11 +101,16 @@ 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
@aspect.contacts_visible = params[:aspect][:contacts_visible]
@aspect.save
flash[:notice] = I18n.t 'aspects.update.success',:name => @aspect.name flash[:notice] = I18n.t 'aspects.update.success',:name => @aspect.name
else else
flash[:error] = I18n.t 'aspects.update.failure',:name => @aspect.name flash[:error] = I18n.t 'aspects.update.failure',:name => @aspect.name
end end
respond_with @aspect respond_with @aspect
end end

View file

@ -16,13 +16,15 @@
= render 'shared/contact_list', :aspect => @aspect, :contacts => @contacts = render 'shared/contact_list', :aspect => @aspect, :contacts => @contacts
#aspect_edit_controls #aspect_edit_controls
= link_to t('.rename'), '#'
\/
= link_to t('delete'), @aspect, :method => "delete", :confirm => t('.confirm_remove_aspect') = link_to t('delete'), @aspect, :method => "delete", :confirm => t('.confirm_remove_aspect')
#rename_aspect #rename_aspect
= form_for @aspect do |asp| = form_for @aspect do |asp|
= asp.text_field :name, :value => @aspect.name = asp.text_field :name
= asp.submit t('.rename_aspect') %p.checkbox_select{:style => 'font-size:14px'}
= asp.label :contacts_visible, t('.make_aspect_list_visible')
= asp.check_box :contacts_visible
%br
%div{:style => "text-align:right;"}
= asp.submit t('.save')

View file

@ -13,6 +13,7 @@
%hr{:style=>"width:300px;"} %hr{:style=>"width:300px;"}
.section.contact_pictures .section.contact_pictures
%h4 %h4
= @contacts_of_contact.length
= t('.similar_contacts') = t('.similar_contacts')
- for person in @contacts_of_contact - for person in @contacts_of_contact
= person_image_link person = person_image_link person

View file

@ -144,8 +144,9 @@ en:
remove_aspect: "Delete this aspect" remove_aspect: "Delete this aspect"
confirm_remove_aspect: "Are you sure you want to delete this aspect?" confirm_remove_aspect: "Are you sure you want to delete this aspect?"
add_existing: "Add an existing contact" add_existing: "Add an existing contact"
rename_aspect: "Rename aspect" save: "Save"
rename: "rename" rename: "rename"
make_aspect_list_visible: "make aspect list visible to others in aspect"
aspect_contacts: aspect_contacts:
done_editing: "done editing" done_editing: "done editing"
show: show: