Commit 495f736d1aadeb5c5a582691d826acbd8bcdc08a
1 parent
a68c9e40
Exists in
master
and in
29 other branches
spread: only shows spread button if user is logged in and content is public
(ActionItem3239)
Showing
2 changed files
with
5 additions
and
2 deletions
Show diff stats
app/models/article.rb
... | ... | @@ -507,7 +507,10 @@ class Article < ActiveRecord::Base |
507 | 507 | end |
508 | 508 | |
509 | 509 | alias :allow_delete? :allow_post_content? |
510 | - alias :allow_spread? :allow_post_content? | |
510 | + | |
511 | + def allow_spread?(user = nil) | |
512 | + user && public? | |
513 | + end | |
511 | 514 | |
512 | 515 | def allow_create?(user) |
513 | 516 | allow_post_content?(user) || allow_publish_content?(user) | ... | ... |
app/views/content_viewer/_article_toolbar.html.erb
... | ... | @@ -15,7 +15,7 @@ |
15 | 15 | <%= expirable_button @page, :delete, content, url, options %> |
16 | 16 | <% end %> |
17 | 17 | |
18 | - <% if !@page.folder? && @page.public? && !remove_content_button(:spread) %> | |
18 | + <% if !@page.folder? && @page.allow_spread?(user) && !remove_content_button(:spread) %> | |
19 | 19 | <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page.id }) %> |
20 | 20 | <%= expirable_button @page, :spread, content_tag( 'span', _('Spread this') ), url, {:class => 'colorbox'} if url %> |
21 | 21 | <% end %> | ... | ... |