Commit 0f801692b91a5e8be235482155d1367a4b6ac0aa

Authored by Victor Costa
1 parent e5407b4a

comment_paragraph: display export button only when activated

plugins/comment_paragraph/lib/comment_paragraph_plugin.rb
... ... @@ -47,18 +47,19 @@ class CommentParagraphPlugin < Noosfero::Plugin
47 47 def article_extra_toolbar_buttons(article)
48 48 user = context.send :user
49 49 return [] if !article.comment_paragraph_plugin_enabled? || !article.allow_edit?(user)
50   - [
  50 + buttons = [
51 51 {
52 52 :title => article.comment_paragraph_plugin_activated? ? _('Deactivate Comments') : _('Activate Comments'),
53 53 :url => {:controller => 'comment_paragraph_plugin_myprofile', :profile => article.profile.identifier, :action => 'toggle_activation', :id => article.id},
54 54 :icon => :toggle_comment_paragraph
55   - },
56   - {
  55 + }
  56 + ]
  57 + buttons << {
57 58 :title => _('Export Comments'),
58 59 :url => {:controller => 'comment_paragraph_plugin_profile', :profile => article.profile.identifier, :action => 'export_comments', :id => article.id},
59 60 :icon => :toggle_comment_paragraph
60   - }
61   - ]
  61 + } if article.comment_paragraph_plugin_activated?
  62 + buttons
62 63 end
63 64  
64 65 end
... ...