diff --git a/app/helpers/article_helper.rb b/app/helpers/article_helper.rb index 98699df..d8903ee 100644 --- a/app/helpers/article_helper.rb +++ b/app/helpers/article_helper.rb @@ -2,14 +2,19 @@ module ArticleHelper def custom_options_for_article(article) @article = article + content_tag('h4', _('Visibility')) + + content_tag('div', + content_tag('div', + radio_button(:article, :published, true) + + content_tag('label', _('Public (visible to other people)'), :for => 'article_published') + ) + + content_tag('div', + radio_button(:article, :published, false) + + content_tag('label', _('Private')) + ) + ) + content_tag('h4', _('Options')) + content_tag('div', - content_tag( - 'div', - check_box(:article, :published) + - content_tag('label', _('This article must be published (visible to other people)'), :for => 'article_published') - ) + - (article.profile.has_members? ? content_tag( 'div', diff --git a/app/helpers/folder_helper.rb b/app/helpers/folder_helper.rb index 3b9a672..d17500a 100644 --- a/app/helpers/folder_helper.rb +++ b/app/helpers/folder_helper.rb @@ -58,13 +58,20 @@ module FolderHelper def custom_options_for_article(article) @article = article + content_tag('h4', _('Visibility')) + + content_tag('div', + content_tag('div', + radio_button(:article, :published, true) + + content_tag('label', _('Public (visible to other people)'), :for => 'article_published') + ) + + content_tag('div', + radio_button(:article, :published, false) + + content_tag('label', _('Private')) + ) + ) + content_tag('h4', _('Options')) + content_tag('div', - content_tag( - 'div', - check_box(:article, :published) + - content_tag('label', _('This article must be published (visible to other people)'), :for => 'article_published') - ) + (article.can_display_hits? ? + (article.can_display_hits? ? content_tag( 'div', check_box(:article, :display_hits) + diff --git a/app/views/profile_editor/edit.rhtml b/app/views/profile_editor/edit.rhtml index d43eb79..2ad0bb8 100644 --- a/app/views/profile_editor/edit.rhtml +++ b/app/views/profile_editor/edit.rhtml @@ -18,33 +18,16 @@

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

<% if profile.person? %> - - - - - - - - - - - - - - - - - - -
- <%= _('This profile is:') %> - - <%= radio_button 'profile_data', 'public_profile', 'true' %> - - - <%= radio_button 'profile_data', 'public_profile', 'false' %> - -
<%= _('Activate Intranet access (restricted area only for me)') %> <%= _('Yes') %><%= _('Yes') %>
<%= _('Include my contact in directory of people') %> <%= _('Yes') %><%= _('Yes') %>
<%= _('Show my contents to all internet users') %> <%= _('Yes') %><%= _('No') %>
<%= _('Show my contents to my friends (person)') %> <%= _('Yes') %><%= _('Yes') %>
+
+ <%= radio_button 'profile_data', 'public_profile', 'true' %> + <%= content_tag('label', _('Public'), :for => 'profile_data_public_profile_true') %> + — show my contents to all internet users +
+
+ <%= radio_button 'profile_data', 'public_profile', 'false' %> + <%= content_tag('label', _('Private'), :for => 'profile_data_public_profile_false') %> + — show my contents only to friends +
<% else %> diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 568ef3b..81d57ee 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -570,15 +570,16 @@ class CmsControllerTest < ActionController::TestCase should 'display published option' do get :edit, :profile => profile.identifier, :id => profile.home_page.id - assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[published]', :checked => 'checked' } + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_true', :checked => 'checked' } + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_false' } end should "display properly a non-published articles' status" do article = profile.articles.create!(:name => 'test', :published => false) get :edit, :profile => profile.identifier, :id => article.id - assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[published]' } - assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'article[published]', :checked => 'checked' } + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_true' } + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'article[published]', :id => 'article_published_false', :checked => 'checked' } end should 'be able to add image with alignment' do diff --git a/test/unit/cms_helper_test.rb b/test/unit/cms_helper_test.rb index 0a19498..f4e048d 100644 --- a/test/unit/cms_helper_test.rb +++ b/test/unit/cms_helper_test.rb @@ -9,7 +9,8 @@ class CmsHelperTest < ActiveSupport::TestCase should 'show default options for article' do CmsHelperTest.any_instance.stubs(:controller).returns(ActionController::Base.new) result = options_for_article(RssFeed.new(:profile => Profile.new)) - assert_match /id="article_published" name="article\[published\]" type="checkbox" value="1"/, result + assert_match /id="article_published_true" name="article\[published\]" type="radio" value="true"/, result + assert_match /id="article_published_false" name="article\[published\]" type="radio" value="false"/, result assert_match /id="article_accept_comments" name="article\[accept_comments\]" type="checkbox" value="1"/, result end -- libgit2 0.21.2