Commit 22235d76bf9b1c6ae51f580dffb22703ff6ad318

Authored by AntonioTerceiro
1 parent 31849db7

ActionItem295: editing public_content


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1828 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/profile_editor/edit.rhtml
@@ -20,6 +20,15 @@ @@ -20,6 +20,15 @@
20 <%= radio_button 'profile_data', 'public_profile', 'false' %> 20 <%= radio_button 'profile_data', 'public_profile', 'false' %>
21 </div> 21 </div>
22 </p> 22 </p>
  23 + <p>
  24 + <%= _("This profile's content is:") %>
  25 + <div>
  26 + <%= radio_button 'profile_data', 'public_content', 'true' %>
  27 + </div>
  28 + <div>
  29 + <%= radio_button 'profile_data', 'public_content', 'false' %>
  30 + </div>
  31 + </p>
23 32
24 <%= select_categories(:profile_data, _('Select the categories of your interest'), 1) %> 33 <%= select_categories(:profile_data, _('Select the categories of your interest'), 1) %>
25 34
test/functional/profile_editor_controller_test.rb
@@ -205,6 +205,21 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase @@ -205,6 +205,21 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
205 assert_equal false, Profile['ze'].public_profile 205 assert_equal false, Profile['ze'].public_profile
206 end 206 end
207 207
  208 + should 'display public_content field for editing' do
  209 + profile = Profile['ze']
  210 + get :edit, :profile => 'ze'
  211 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_content]', :value => 'true' }
  212 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_content]', :value => 'false' }
  213 + end
  214 +
  215 + should 'display properly that the content is non-public' do
  216 + profile = Profile['ze']
  217 + profile.update_attributes(:public_content => false)
  218 + get :edit, :profile => 'ze'
  219 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_content]', :value => 'false' }
  220 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_content]', :value => 'true' }
  221 + end
  222 +
208 should 'show error messages for invalid foundation_year' do 223 should 'show error messages for invalid foundation_year' do
209 org = Organization.create!(:name => 'test org', :identifier => 'testorg') 224 org = Organization.create!(:name => 'test org', :identifier => 'testorg')
210 post :edit, :profile => 'testorg', :profile_data => { :foundation_year => 'aaa' } 225 post :edit, :profile => 'testorg', :profile_data => { :foundation_year => 'aaa' }