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 | 22 | title |
23 | 23 | end |
24 | 24 | |
25 | - #FIXME make this test | |
26 | 25 | def comment_actions(comment) |
27 | 26 | links = links_for_comment_actions(comment) |
28 | 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 | 30 | private |
32 | 31 | |
33 | 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 | 35 | end |
45 | 36 | |
46 | 37 | def link_for_report_abuse(comment) | ... | ... |
lib/noosfero/plugin.rb
... | ... | @@ -277,6 +277,18 @@ class Noosfero::Plugin |
277 | 277 | def comment_marked_as_ham(comment) |
278 | 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 | 292 | # -> Adds fields to the signup form |
281 | 293 | # returns = lambda block that creates html code |
282 | 294 | def signup_extra_contents | ... | ... |