Commit c844e9c39c2a9cc3f8b17e79a0a286b3a3192878
1 parent
dc107520
Exists in
master
and in
28 other branches
adding comment_actions plugin
Showing
4 changed files
with
34 additions
and
1 deletions
Show diff stats
app/helpers/comment_helper.rb
@@ -31,7 +31,16 @@ module CommentHelper | @@ -31,7 +31,16 @@ module CommentHelper | ||
31 | private | 31 | private |
32 | 32 | ||
33 | def links_for_comment_actions(comment) | 33 | def links_for_comment_actions(comment) |
34 | - [link_for_report_abuse(comment), link_for_spam(comment), link_for_edit(comment), link_for_remove(comment)].compact | 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) | ||
35 | end | 44 | end |
36 | 45 | ||
37 | def link_for_report_abuse(comment) | 46 | def link_for_report_abuse(comment) |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +require 'comment_actions_plugin' |
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
1 | +class CommentActionsPlugin < Noosfero::Plugin | ||
2 | + | ||
3 | + def self.plugin_name | ||
4 | + "Comment Actions" | ||
5 | + end | ||
6 | + | ||
7 | + def self.plugin_description | ||
8 | + _("A comment action menu plugin!") | ||
9 | + end | ||
10 | + | ||
11 | + def comment_actions(comment) | ||
12 | + [ | ||
13 | + { | ||
14 | + s_('Mark as read') => { | ||
15 | + 'href' => '#', | ||
16 | + 'onclick' => 'alert(\'Click on Mark as read action!\')' | ||
17 | + } | ||
18 | + } | ||
19 | + ] | ||
20 | + end | ||
21 | + | ||
22 | +end |