From 0f801692b91a5e8be235482155d1367a4b6ac0aa Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 21 Jan 2016 17:17:01 -0300 Subject: [PATCH] comment_paragraph: display export button only when activated --- plugins/comment_paragraph/lib/comment_paragraph_plugin.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb b/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb index 1129dad..b7e5b02 100644 --- a/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb +++ b/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb @@ -47,18 +47,19 @@ class CommentParagraphPlugin < Noosfero::Plugin def article_extra_toolbar_buttons(article) user = context.send :user return [] if !article.comment_paragraph_plugin_enabled? || !article.allow_edit?(user) - [ + buttons = [ { :title => article.comment_paragraph_plugin_activated? ? _('Deactivate Comments') : _('Activate Comments'), :url => {:controller => 'comment_paragraph_plugin_myprofile', :profile => article.profile.identifier, :action => 'toggle_activation', :id => article.id}, :icon => :toggle_comment_paragraph - }, - { + } + ] + buttons << { :title => _('Export Comments'), :url => {:controller => 'comment_paragraph_plugin_profile', :profile => article.profile.identifier, :action => 'export_comments', :id => article.id}, :icon => :toggle_comment_paragraph - } - ] + } if article.comment_paragraph_plugin_activated? + buttons end end -- libgit2 0.21.2