Commit 5bd427bdb29779b98de5324185505fe4472727db
1 parent
c844e9c3
Exists in
master
and in
28 other branches
adding hot spot for comments extra actions
Showing
2 changed files
with
14 additions
and
11 deletions
Show diff stats
app/helpers/comment_helper.rb
@@ -22,7 +22,6 @@ module CommentHelper | @@ -22,7 +22,6 @@ module CommentHelper | ||
22 | title | 22 | title |
23 | end | 23 | end |
24 | 24 | ||
25 | - #FIXME make this test | ||
26 | def comment_actions(comment) | 25 | def comment_actions(comment) |
27 | links = links_for_comment_actions(comment) | 26 | links = links_for_comment_actions(comment) |
28 | 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? | 27 | 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 | @@ -31,16 +30,8 @@ module CommentHelper | ||
31 | private | 30 | private |
32 | 31 | ||
33 | def links_for_comment_actions(comment) | 32 | def links_for_comment_actions(comment) |
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) | 33 | + actions = [link_for_report_abuse(comment), link_for_spam(comment), link_for_edit(comment), link_for_remove(comment)] |
34 | + actions += @plugins.dispatch(:comment_actions, comment) | ||
44 | end | 35 | end |
45 | 36 | ||
46 | def link_for_report_abuse(comment) | 37 | def link_for_report_abuse(comment) |
lib/noosfero/plugin.rb
@@ -277,6 +277,18 @@ class Noosfero::Plugin | @@ -277,6 +277,18 @@ class Noosfero::Plugin | ||
277 | def comment_marked_as_ham(comment) | 277 | def comment_marked_as_ham(comment) |
278 | end | 278 | end |
279 | 279 | ||
280 | + # Adds extra actions for comments | ||
281 | + # | ||
282 | + # example: | ||
283 | + # | ||
284 | + # def comment_actions(comment) | ||
285 | + # [{:link => link_to_function(...)}] | ||
286 | + # end | ||
287 | + # | ||
288 | + def comment_actions(comment) | ||
289 | + nil | ||
290 | + end | ||
291 | + | ||
280 | # -> Adds fields to the signup form | 292 | # -> Adds fields to the signup form |
281 | # returns = lambda block that creates html code | 293 | # returns = lambda block that creates html code |
282 | def signup_extra_contents | 294 | def signup_extra_contents |