Commit 938c96a134794e6014b4c0c6cad37426dc130d1f
1 parent
7bf7fff2
Exists in
master
and in
29 other branches
Changes UI of article's visibility
Changes from checkbox to radio box, with options private and public. Also removes confusing table about profile visibility in control panel. StoaItem18
Showing
5 changed files
with
39 additions
and
42 deletions
Show diff stats
app/helpers/article_helper.rb
... | ... | @@ -2,14 +2,19 @@ module ArticleHelper |
2 | 2 | |
3 | 3 | def custom_options_for_article(article) |
4 | 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 | 16 | content_tag('h4', _('Options')) + |
6 | 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 | 18 | (article.profile.has_members? ? |
14 | 19 | content_tag( |
15 | 20 | 'div', | ... | ... |
app/helpers/folder_helper.rb
... | ... | @@ -58,13 +58,20 @@ module FolderHelper |
58 | 58 | |
59 | 59 | def custom_options_for_article(article) |
60 | 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 | 72 | content_tag('h4', _('Options')) + |
62 | 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 | 75 | content_tag( |
69 | 76 | 'div', |
70 | 77 | check_box(:article, :display_hits) + | ... | ... |
app/views/profile_editor/edit.rhtml
... | ... | @@ -18,33 +18,16 @@ |
18 | 18 | <h2><%= _('Privacy options') %></h2> |
19 | 19 | |
20 | 20 | <% if profile.person? %> |
21 | - <table> | |
22 | - <tr> | |
23 | - <th style='text-align: right;'> | |
24 | - <%= _('This profile is:') %> | |
25 | - </th> | |
26 | - <th> | |
27 | - <%= radio_button 'profile_data', 'public_profile', 'true' %> | |
28 | - <label for="profile_data_public_profile_true"><u><%= _('Public') %></u></label> | |
29 | - </th> | |
30 | - <th style='padding: 2px 10px 2px 2px;'> | |
31 | - <%= radio_button 'profile_data', 'public_profile', 'false' %> | |
32 | - <label for="profile_data_public_profile_false"><u><%= _('Private') %></u></label> | |
33 | - </th> | |
34 | - </tr> | |
35 | - <tr> | |
36 | - <td> <%= _('Activate Intranet access (restricted area only for me)') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td> | |
37 | - </tr> | |
38 | - <tr> | |
39 | - <td> <%= _('Include my contact in directory of people') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td> | |
40 | - </tr> | |
41 | - <tr> | |
42 | - <td> <%= _('Show my contents to all internet users') %> </td><td><%= _('Yes') %></td><td><%= _('No') %></td> | |
43 | - </tr> | |
44 | - <tr> | |
45 | - <td> <%= _('Show my contents to my friends (person)') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td> | |
46 | - </tr> | |
47 | - </table> | |
21 | + <div> | |
22 | + <%= radio_button 'profile_data', 'public_profile', 'true' %> | |
23 | + <%= content_tag('label', _('Public'), :for => 'profile_data_public_profile_true') %> | |
24 | + — show my contents to all internet users | |
25 | + </div> | |
26 | + <div> | |
27 | + <%= radio_button 'profile_data', 'public_profile', 'false' %> | |
28 | + <%= content_tag('label', _('Private'), :for => 'profile_data_public_profile_false') %> | |
29 | + — show my contents only to friends | |
30 | + </div> | |
48 | 31 | <% else %> |
49 | 32 | <table> |
50 | 33 | <tr> | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -570,15 +570,16 @@ class CmsControllerTest < ActionController::TestCase |
570 | 570 | |
571 | 571 | should 'display published option' do |
572 | 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 | 575 | end |
575 | 576 | |
576 | 577 | should "display properly a non-published articles' status" do |
577 | 578 | article = profile.articles.create!(:name => 'test', :published => false) |
578 | 579 | |
579 | 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 | 583 | end |
583 | 584 | |
584 | 585 | should 'be able to add image with alignment' do | ... | ... |
test/unit/cms_helper_test.rb
... | ... | @@ -9,7 +9,8 @@ class CmsHelperTest < ActiveSupport::TestCase |
9 | 9 | should 'show default options for article' do |
10 | 10 | CmsHelperTest.any_instance.stubs(:controller).returns(ActionController::Base.new) |
11 | 11 | result = options_for_article(RssFeed.new(:profile => Profile.new)) |
12 | - assert_match /id="article_published" name="article\[published\]" type="checkbox" value="1"/, result | |
12 | + assert_match /id="article_published_true" name="article\[published\]" type="radio" value="true"/, result | |
13 | + assert_match /id="article_published_false" name="article\[published\]" type="radio" value="false"/, result | |
13 | 14 | assert_match /id="article_accept_comments" name="article\[accept_comments\]" type="checkbox" value="1"/, result |
14 | 15 | end |
15 | 16 | ... | ... |