From 0baf2a2978fc4e57a065fe7919ed52bc0921b5ca Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 21 May 2008 20:41:40 +0000 Subject: [PATCH] ActionItem295: editing public/private profile --- app/views/profile_editor/edit.rhtml | 17 ++++++++++++++++- test/functional/profile_editor_controller_test.rb | 12 ++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/app/views/profile_editor/edit.rhtml b/app/views/profile_editor/edit.rhtml index df8d6fa..755fa7e 100644 --- a/app/views/profile_editor/edit.rhtml +++ b/app/views/profile_editor/edit.rhtml @@ -4,11 +4,26 @@ <% labelled_form_for :profile_data, @profile, :html => { :multipart => true } do |f| %> <%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %> -

<%= _('Change your picture') %>

+ +

<%= _('Change picture') %>

<% f.fields_for :image_builder, @profile.image do |i| %> <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %> <% end %> + +

<%= _('Privacy options') %>

+

+ <%= _('This profile is:') %> +

+ <%= radio_button 'profile_data', 'public_profile', 'true' %> +
+
+ <%= radio_button 'profile_data', 'public_profile', 'false' %> +
+

+ <%= select_categories(:profile_data, _('Select the categories of your interest'), 1) %> + + <% button_bar do %> <%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %> <%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %> diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 5d8a2d3..dfddb2b 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -183,8 +183,16 @@ class ProfileEditorControllerTest < Test::Unit::TestCase should 'display profile publication option in edit profile screen' do profile = Profile['ze'] get :edit, :profile => 'ze' - assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'true' } - assert_tag :tag => 'input', :attributes => { :type => 'hidden', :name => 'profile_data[public_profile]', :value => false } + assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'true' } + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_profile]', :value => 'false' } + end + + should 'display properly that the profile is non-public' do + profile = Profile['ze'] + profile.update_attributes!(:public_profile => false) + get :edit, :profile => 'ze' + assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'false' } + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[public_profile]', :value => 'true' } end should 'save profile publication option set to true' do -- libgit2 0.21.2