From 5bd427bdb29779b98de5324185505fe4472727db Mon Sep 17 00:00:00 2001 From: vfcosta Date: Wed, 8 May 2013 17:23:40 -0300 Subject: [PATCH] adding hot spot for comments extra actions --- app/helpers/comment_helper.rb | 13 ++----------- lib/noosfero/plugin.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/helpers/comment_helper.rb b/app/helpers/comment_helper.rb index 932e125..5dbc092 100644 --- a/app/helpers/comment_helper.rb +++ b/app/helpers/comment_helper.rb @@ -22,7 +22,6 @@ module CommentHelper title end - #FIXME make this test def comment_actions(comment) links = links_for_comment_actions(comment) content_tag(:li, link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{links.to_json}); return false", :class => 'menu-submenu-trigger'), :class=> 'vcard') unless links.empty? @@ -31,16 +30,8 @@ module CommentHelper private def links_for_comment_actions(comment) - 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) + actions = [link_for_report_abuse(comment), link_for_spam(comment), link_for_edit(comment), link_for_remove(comment)] + actions += @plugins.dispatch(:comment_actions, comment) end def link_for_report_abuse(comment) diff --git a/lib/noosfero/plugin.rb b/lib/noosfero/plugin.rb index 2d18941..33a1327 100644 --- a/lib/noosfero/plugin.rb +++ b/lib/noosfero/plugin.rb @@ -277,6 +277,18 @@ class Noosfero::Plugin def comment_marked_as_ham(comment) end + # Adds extra actions for comments + # + # example: + # + # def comment_actions(comment) + # [{:link => link_to_function(...)}] + # end + # + def comment_actions(comment) + nil + end + # -> Adds fields to the signup form # returns = lambda block that creates html code def signup_extra_contents -- libgit2 0.21.2