Commit a80f69f8a3ed08899567edcf9f9e660fc5cba16c

Authored by Daniela Feitosa
2 parents f037897f 938c96a1

Merge commit 'refs/merge-requests/236' of git://gitorious.org/noosfero/noosfero …

…into merge-requests/236
app/helpers/article_helper.rb
@@ -2,14 +2,19 @@ module ArticleHelper @@ -2,14 +2,19 @@ module ArticleHelper
2 2
3 def custom_options_for_article(article) 3 def custom_options_for_article(article)
4 @article = article 4 @article = article
  5 + content_tag('h4', _('Visibility')) +
  6 + content_tag('div',
  7 + content_tag('div',
  8 + radio_button(:article, :published, true) +
  9 + content_tag('label', _('Public (visible to other people)'), :for => 'article_published')
  10 + ) +
  11 + content_tag('div',
  12 + radio_button(:article, :published, false) +
  13 + content_tag('label', _('Private'))
  14 + )
  15 + ) +
5 content_tag('h4', _('Options')) + 16 content_tag('h4', _('Options')) +
6 content_tag('div', 17 content_tag('div',
7 - content_tag(  
8 - 'div',  
9 - check_box(:article, :published) +  
10 - content_tag('label', _('This article must be published (visible to other people)'), :for => 'article_published')  
11 - ) +  
12 -  
13 (article.profile.has_members? ? 18 (article.profile.has_members? ?
14 content_tag( 19 content_tag(
15 'div', 20 'div',
app/helpers/folder_helper.rb
@@ -58,13 +58,20 @@ module FolderHelper @@ -58,13 +58,20 @@ module FolderHelper
58 58
59 def custom_options_for_article(article) 59 def custom_options_for_article(article)
60 @article = article 60 @article = article
  61 + content_tag('h4', _('Visibility')) +
  62 + content_tag('div',
  63 + content_tag('div',
  64 + radio_button(:article, :published, true) +
  65 + content_tag('label', _('Public (visible to other people)'), :for => 'article_published')
  66 + ) +
  67 + content_tag('div',
  68 + radio_button(:article, :published, false) +
  69 + content_tag('label', _('Private'))
  70 + )
  71 + ) +
61 content_tag('h4', _('Options')) + 72 content_tag('h4', _('Options')) +
62 content_tag('div', 73 content_tag('div',
63 - content_tag(  
64 - 'div',  
65 - check_box(:article, :published) +  
66 - content_tag('label', _('This article must be published (visible to other people)'), :for => 'article_published')  
67 - ) + (article.can_display_hits? ? 74 + (article.can_display_hits? ?
68 content_tag( 75 content_tag(
69 'div', 76 'div',
70 check_box(:article, :display_hits) + 77 check_box(:article, :display_hits) +
app/views/profile_editor/edit.rhtml
@@ -24,33 +24,16 @@ @@ -24,33 +24,16 @@
24 <h2><%= _('Privacy options') %></h2> 24 <h2><%= _('Privacy options') %></h2>
25 25
26 <% if profile.person? %> 26 <% if profile.person? %>
27 - <table>  
28 - <tr>  
29 - <th style='text-align: right;'>  
30 - <%= _('This profile is:') %>  
31 - </th>  
32 - <th>  
33 - <%= radio_button 'profile_data', 'public_profile', 'true' %>  
34 - <label for="profile_data_public_profile_true"><u><%= _('Public') %></u></label>  
35 - </th>  
36 - <th style='padding: 2px 10px 2px 2px;'>  
37 - <%= radio_button 'profile_data', 'public_profile', 'false' %>  
38 - <label for="profile_data_public_profile_false"><u><%= _('Private') %></u></label>  
39 - </th>  
40 - </tr>  
41 - <tr>  
42 - <td> <%= _('Activate Intranet access (restricted area only for me)') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td>  
43 - </tr>  
44 - <tr>  
45 - <td> <%= _('Include my contact in directory of people') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td>  
46 - </tr>  
47 - <tr>  
48 - <td> <%= _('Show my contents to all internet users') %> </td><td><%= _('Yes') %></td><td><%= _('No') %></td>  
49 - </tr>  
50 - <tr>  
51 - <td> <%= _('Show my contents to my friends (person)') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td>  
52 - </tr>  
53 - </table> 27 + <div>
  28 + <%= radio_button 'profile_data', 'public_profile', 'true' %>
  29 + <%= content_tag('label', _('Public'), :for => 'profile_data_public_profile_true') %>
  30 + &mdash; show my contents to all internet users
  31 + </div>
  32 + <div>
  33 + <%= radio_button 'profile_data', 'public_profile', 'false' %>
  34 + <%= content_tag('label', _('Private'), :for => 'profile_data_public_profile_false') %>
  35 + &mdash; show my contents only to friends
  36 + </div>
54 <% else %> 37 <% else %>
55 <table> 38 <table>
56 <tr> 39 <tr>
test/functional/cms_controller_test.rb
@@ -570,15 +570,16 @@ class CmsControllerTest &lt; ActionController::TestCase @@ -570,15 +570,16 @@ class CmsControllerTest &lt; ActionController::TestCase
570 570
571 should 'display published option' do 571 should 'display published option' do
572 get :edit, :profile => profile.identifier, :id => profile.home_page.id 572 get :edit, :profile => profile.identifier, :id => profile.home_page.id
573 - assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[published]', :checked => 'checked' } 573 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_true', :checked => 'checked' }
  574 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_false' }
574 end 575 end
575 576
576 should "display properly a non-published articles' status" do 577 should "display properly a non-published articles' status" do
577 article = profile.articles.create!(:name => 'test', :published => false) 578 article = profile.articles.create!(:name => 'test', :published => false)
578 579
579 get :edit, :profile => profile.identifier, :id => article.id 580 get :edit, :profile => profile.identifier, :id => article.id
580 - assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[published]' }  
581 - assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[published]', :checked => 'checked' } 581 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_true' }
  582 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_false', :checked => 'checked' }
582 end 583 end
583 584
584 should 'be able to add image with alignment' do 585 should 'be able to add image with alignment' do
test/unit/cms_helper_test.rb
@@ -10,7 +10,8 @@ class CmsHelperTest &lt; ActiveSupport::TestCase @@ -10,7 +10,8 @@ class CmsHelperTest &lt; ActiveSupport::TestCase
10 should 'show default options for article' do 10 should 'show default options for article' do
11 CmsHelperTest.any_instance.stubs(:controller).returns(ActionController::Base.new) 11 CmsHelperTest.any_instance.stubs(:controller).returns(ActionController::Base.new)
12 result = options_for_article(RssFeed.new(:profile => Profile.new)) 12 result = options_for_article(RssFeed.new(:profile => Profile.new))
13 - assert_match /id="article_published" name="article\[published\]" type="checkbox" value="1"/, result 13 + assert_match /id="article_published_true" name="article\[published\]" type="radio" value="true"/, result
  14 + assert_match /id="article_published_false" name="article\[published\]" type="radio" value="false"/, result
14 assert_match /id="article_accept_comments" name="article\[accept_comments\]" type="checkbox" value="1"/, result 15 assert_match /id="article_accept_comments" name="article\[accept_comments\]" type="checkbox" value="1"/, result
15 end 16 end
16 17