Commit c844e9c39c2a9cc3f8b17e79a0a286b3a3192878

Authored by Francisco Marcelo de Araujo Lima Junior
1 parent dc107520

adding comment_actions plugin

app/helpers/comment_helper.rb
@@ -31,7 +31,16 @@ module CommentHelper @@ -31,7 +31,16 @@ module CommentHelper
31 private 31 private
32 32
33 def links_for_comment_actions(comment) 33 def links_for_comment_actions(comment)
34 - [link_for_report_abuse(comment), link_for_spam(comment), link_for_edit(comment), link_for_remove(comment)].compact 34 + actions = []
  35 +
  36 + @plugins.dispatch(:comment_actions, comment).each do |action|
  37 + actions << action
  38 + end
  39 +
  40 + actions << link_for_report_abuse(comment)
  41 + actions << link_for_spam(comment)
  42 + actions << link_for_edit(comment)
  43 + actions << link_for_remove(comment)
35 end 44 end
36 45
37 def link_for_report_abuse(comment) 46 def link_for_report_abuse(comment)
config/plugins/comment_actions 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +/home/79350259591/Projects/WebApps/Rails/Noosfero/plugins/comment_actions
0 \ No newline at end of file 2 \ No newline at end of file
plugins/comment_actions/init.rb 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +require 'comment_actions_plugin'
plugins/comment_actions/lib/comment_actions_plugin.rb 0 → 100644
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
  1 +class CommentActionsPlugin < Noosfero::Plugin
  2 +
  3 + def self.plugin_name
  4 + "Comment Actions"
  5 + end
  6 +
  7 + def self.plugin_description
  8 + _("A comment action menu plugin!")
  9 + end
  10 +
  11 + def comment_actions(comment)
  12 + [
  13 + {
  14 + s_('Mark as read') => {
  15 + 'href' => '#',
  16 + 'onclick' => 'alert(\'Click on Mark as read action!\')'
  17 + }
  18 + }
  19 + ]
  20 + end
  21 +
  22 +end