From c844e9c39c2a9cc3f8b17e79a0a286b3a3192878 Mon Sep 17 00:00:00 2001 From: Francisco Marcelo de Araujo Lima Junior <79350259591@serpro-1457614.(none)> Date: Fri, 12 Apr 2013 10:09:35 -0300 Subject: [PATCH] adding comment_actions plugin --- app/helpers/comment_helper.rb | 11 ++++++++++- config/plugins/comment_actions | 1 + plugins/comment_actions/init.rb | 1 + plugins/comment_actions/lib/comment_actions_plugin.rb | 22 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 120000 config/plugins/comment_actions create mode 100644 plugins/comment_actions/init.rb create mode 100644 plugins/comment_actions/lib/comment_actions_plugin.rb 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