Commit 7911d32bbb67031c3b8d6b506b22c3b01aaa8135
1 parent
99d66a60
Exists in
master
and in
29 other branches
Extending hotspot for removing new and upload buttons from article actions
Showing
3 changed files
with
13 additions
and
3 deletions
Show diff stats
app/views/content_viewer/_article_toolbar.rhtml
... | ... | @@ -34,11 +34,11 @@ |
34 | 34 | <%= expirable_button @page, :locale, content, url %> |
35 | 35 | <% end %> |
36 | 36 | |
37 | - <%= colorbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) %> | |
37 | + <%= colorbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) if !remove_content_button(:new) %> | |
38 | 38 | <% end %> |
39 | 39 | |
40 | 40 | <% if @page.accept_uploads? && @page.allow_create?(user) %> |
41 | - <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %> | |
41 | + <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) if !remove_content_button(:upload)%> | |
42 | 42 | <% end %> |
43 | 43 | |
44 | 44 | <% if !@page.allow_create?(user) && profile.community? && (@page.blog? || @page.parent && @page.parent.blog?) && !remove_content_button(:suggest) %> | ... | ... |
lib/noosfero/plugin.rb
... | ... | @@ -353,7 +353,9 @@ class Noosfero::Plugin |
353 | 353 | private |
354 | 354 | |
355 | 355 | def content_actions |
356 | - %w[edit delete spread locale suggest home] | |
356 | + #FIXME 'new' and 'upload' only works for content_remove. It should work for | |
357 | + #content_expire too. | |
358 | + %w[edit delete spread locale suggest home new upload] | |
357 | 359 | end |
358 | 360 | |
359 | 361 | end | ... | ... |
plugins/work_assignment/lib/work_assignment_plugin.rb
... | ... | @@ -16,4 +16,12 @@ class WorkAssignmentPlugin < Noosfero::Plugin |
16 | 16 | true |
17 | 17 | end |
18 | 18 | |
19 | + def content_remove_new(content) | |
20 | + content.kind_of?(WorkAssignmentPlugin::WorkAssignment) | |
21 | + end | |
22 | + | |
23 | + def content_remove_upload(content) | |
24 | + !content.profile.members.include?(context.send(:user)) | |
25 | + end | |
26 | + | |
19 | 27 | end | ... | ... |