Commit 0f801692b91a5e8be235482155d1367a4b6ac0aa
1 parent
e5407b4a
Exists in
staging
and in
3 other branches
comment_paragraph: display export button only when activated
Showing
1 changed file
with
6 additions
and
5 deletions
Show diff stats
plugins/comment_paragraph/lib/comment_paragraph_plugin.rb
@@ -47,18 +47,19 @@ class CommentParagraphPlugin < Noosfero::Plugin | @@ -47,18 +47,19 @@ class CommentParagraphPlugin < Noosfero::Plugin | ||
47 | def article_extra_toolbar_buttons(article) | 47 | def article_extra_toolbar_buttons(article) |
48 | user = context.send :user | 48 | user = context.send :user |
49 | return [] if !article.comment_paragraph_plugin_enabled? || !article.allow_edit?(user) | 49 | return [] if !article.comment_paragraph_plugin_enabled? || !article.allow_edit?(user) |
50 | - [ | 50 | + buttons = [ |
51 | { | 51 | { |
52 | :title => article.comment_paragraph_plugin_activated? ? _('Deactivate Comments') : _('Activate Comments'), | 52 | :title => article.comment_paragraph_plugin_activated? ? _('Deactivate Comments') : _('Activate Comments'), |
53 | :url => {:controller => 'comment_paragraph_plugin_myprofile', :profile => article.profile.identifier, :action => 'toggle_activation', :id => article.id}, | 53 | :url => {:controller => 'comment_paragraph_plugin_myprofile', :profile => article.profile.identifier, :action => 'toggle_activation', :id => article.id}, |
54 | :icon => :toggle_comment_paragraph | 54 | :icon => :toggle_comment_paragraph |
55 | - }, | ||
56 | - { | 55 | + } |
56 | + ] | ||
57 | + buttons << { | ||
57 | :title => _('Export Comments'), | 58 | :title => _('Export Comments'), |
58 | :url => {:controller => 'comment_paragraph_plugin_profile', :profile => article.profile.identifier, :action => 'export_comments', :id => article.id}, | 59 | :url => {:controller => 'comment_paragraph_plugin_profile', :profile => article.profile.identifier, :action => 'export_comments', :id => article.id}, |
59 | :icon => :toggle_comment_paragraph | 60 | :icon => :toggle_comment_paragraph |
60 | - } | ||
61 | - ] | 61 | + } if article.comment_paragraph_plugin_activated? |
62 | + buttons | ||
62 | end | 63 | end |
63 | 64 | ||
64 | end | 65 | end |