diff --git a/app/views/cms/view.rhtml b/app/views/cms/view.rhtml
index 6978dba..9ce4817 100644
--- a/app/views/cms/view.rhtml
+++ b/app/views/cms/view.rhtml
@@ -77,7 +77,9 @@
<%= button_without_text :edit, _('Edit'), :action => 'edit', :id => item.id %>
<%= button_without_text :eyes, _('Public view'), item.url %>
- <%= button_without_text :spread, _('Spread this'), :action => 'publish', :id => item.id %>
+ <% if profile.person? %>
+ <%= button_without_text :spread, _('Spread this'), :action => 'publish', :id => item.id %>
+ <% end %>
<%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %>
<%= button_without_text :delete, _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %>
|
diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb
index 2085930..bca0f7d 100644
--- a/test/functional/cms_controller_test.rb
+++ b/test/functional/cms_controller_test.rb
@@ -1095,4 +1095,20 @@ class CmsControllerTest < Test::Unit::TestCase
assert_template nil
assert_redirected_to :action => 'media_listing'
end
+
+ should "display 'Publish' when profile is a person" do
+ a = profile.articles.create!(:name => 'my new home page')
+ Article.stubs(:short_description).returns('bli')
+ get :index, :profile => profile.identifier
+ assert_tag :tag => 'a', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/publish/#{a.id}"}
+ end
+
+ should "not display 'Publish' when profile is not a person" do
+ p = Community.create!(:name => 'community-test')
+ p.add_admin(profile)
+ a = p.articles.create!(:name => 'my new home page')
+ Article.stubs(:short_description).returns('bli')
+ get :index, :profile => p.identifier
+ assert_no_tag :tag => 'a', :attributes => {:href => "/myprofile/#{p.identifier}/cms/publish/#{a.id}"}
+ end
end
--
libgit2 0.21.2