Commit 87d67bcc2d2cafcffc210524cbabc9ee21e83336
1 parent
ee963193
Exists in
master
and in
29 other branches
ActionItem1083: only person can publish articles
Showing
2 changed files
with
19 additions
and
1 deletions
Show diff stats
app/views/cms/view.rhtml
... | ... | @@ -77,7 +77,9 @@ |
77 | 77 | <td> |
78 | 78 | <%= button_without_text :edit, _('Edit'), :action => 'edit', :id => item.id %> |
79 | 79 | <%= button_without_text :eyes, _('Public view'), item.url %> |
80 | - <%= button_without_text :spread, _('Spread this'), :action => 'publish', :id => item.id %> | |
80 | + <% if profile.person? %> | |
81 | + <%= button_without_text :spread, _('Spread this'), :action => 'publish', :id => item.id %> | |
82 | + <% end %> | |
81 | 83 | <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %> |
82 | 84 | <%= button_without_text :delete, _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %> |
83 | 85 | </td> | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -1095,4 +1095,20 @@ class CmsControllerTest < Test::Unit::TestCase |
1095 | 1095 | assert_template nil |
1096 | 1096 | assert_redirected_to :action => 'media_listing' |
1097 | 1097 | end |
1098 | + | |
1099 | + should "display 'Publish' when profile is a person" do | |
1100 | + a = profile.articles.create!(:name => 'my new home page') | |
1101 | + Article.stubs(:short_description).returns('bli') | |
1102 | + get :index, :profile => profile.identifier | |
1103 | + assert_tag :tag => 'a', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/publish/#{a.id}"} | |
1104 | + end | |
1105 | + | |
1106 | + should "not display 'Publish' when profile is not a person" do | |
1107 | + p = Community.create!(:name => 'community-test') | |
1108 | + p.add_admin(profile) | |
1109 | + a = p.articles.create!(:name => 'my new home page') | |
1110 | + Article.stubs(:short_description).returns('bli') | |
1111 | + get :index, :profile => p.identifier | |
1112 | + assert_no_tag :tag => 'a', :attributes => {:href => "/myprofile/#{p.identifier}/cms/publish/#{a.id}"} | |
1113 | + end | |
1098 | 1114 | end | ... | ... |