diff --git a/app/helpers/comment_helper.rb b/app/helpers/comment_helper.rb index 36a52f7..932e125 100644 --- a/app/helpers/comment_helper.rb +++ b/app/helpers/comment_helper.rb @@ -31,7 +31,16 @@ module CommentHelper private def links_for_comment_actions(comment) - [link_for_report_abuse(comment), link_for_spam(comment), link_for_edit(comment), link_for_remove(comment)].compact + actions = [] + + @plugins.dispatch(:comment_actions, comment).each do |action| + actions << action + end + + actions << link_for_report_abuse(comment) + actions << link_for_spam(comment) + actions << link_for_edit(comment) + actions << link_for_remove(comment) end def link_for_report_abuse(comment) diff --git a/config/plugins/comment_actions b/config/plugins/comment_actions new file mode 120000 index 0000000..89db077 --- /dev/null +++ b/config/plugins/comment_actions @@ -0,0 +1 @@ +/home/79350259591/Projects/WebApps/Rails/Noosfero/plugins/comment_actions \ No newline at end of file diff --git a/plugins/comment_actions/init.rb b/plugins/comment_actions/init.rb new file mode 100644 index 0000000..b0dc2c0 --- /dev/null +++ b/plugins/comment_actions/init.rb @@ -0,0 +1 @@ +require 'comment_actions_plugin' diff --git a/plugins/comment_actions/lib/comment_actions_plugin.rb b/plugins/comment_actions/lib/comment_actions_plugin.rb new file mode 100644 index 0000000..c294442 --- /dev/null +++ b/plugins/comment_actions/lib/comment_actions_plugin.rb @@ -0,0 +1,22 @@ +class CommentActionsPlugin < Noosfero::Plugin + + def self.plugin_name + "Comment Actions" + end + + def self.plugin_description + _("A comment action menu plugin!") + end + + def comment_actions(comment) + [ + { + s_('Mark as read') => { + 'href' => '#', + 'onclick' => 'alert(\'Click on Mark as read action!\')' + } + } + ] + end + +end -- libgit2 0.21.2