Commit 0baf2a2978fc4e57a065fe7919ed52bc0921b5ca

Authored by AntonioTerceiro
1 parent 97f7844e

ActionItem295: editing public/private profile


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1822 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/profile_editor/edit.rhtml
... ... @@ -4,11 +4,26 @@
4 4  
5 5 <% labelled_form_for :profile_data, @profile, :html => { :multipart => true } do |f| %>
6 6 <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %>
7   - <h1><%= _('Change your picture') %></h1>
  7 +
  8 + <h1><%= _('Change picture') %></h1>
8 9 <% f.fields_for :image_builder, @profile.image do |i| %>
9 10 <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %>
10 11 <% end %>
  12 +
  13 + <h1><%= _('Privacy options') %></h1>
  14 + <p>
  15 + <%= _('This profile is:') %>
  16 + <div>
  17 + <%= radio_button 'profile_data', 'public_profile', 'true' %>
  18 + </div>
  19 + <div>
  20 + <%= radio_button 'profile_data', 'public_profile', 'false' %>
  21 + </div>
  22 + </p>
  23 +
11 24 <%= select_categories(:profile_data, _('Select the categories of your interest'), 1) %>
  25 +
  26 +
12 27 <% button_bar do %>
13 28 <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %>
14 29 <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %>
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -183,8 +183,16 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
183 183 should 'display profile publication option in edit profile screen' do
184 184 profile = Profile['ze']
185 185 get :edit, :profile => 'ze'
186   - assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'true' }
187   - assert_tag :tag => 'input', :attributes => { :type => 'hidden', :name => 'profile_data[public_profile]', :value => false }
  186 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'true' }
  187 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_profile]', :value => 'false' }
  188 + end
  189 +
  190 + should 'display properly that the profile is non-public' do
  191 + profile = Profile['ze']
  192 + profile.update_attributes!(:public_profile => false)
  193 + get :edit, :profile => 'ze'
  194 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'false' }
  195 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_profile]', :value => 'true' }
188 196 end
189 197  
190 198 should 'save profile publication option set to true' do
... ...