communities_ratings_plugin.rb
1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
class CommunitiesRatingsPlugin < Noosfero::Plugin
include Noosfero::Plugin::HotSpot
def self.plugin_name
"Communities Ratings"
end
def self.plugin_description
_("A plugin that allows you to rate a community and comment about it.")
end
module Hotspots
def communities_ratings_plugin_comments_extra_fields
nil
end
def communities_ratings_title
nil
end
def communities_ratings_plugin_star_message
nil
end
def communities_ratings_plugin_extra_fields_show_data user_rating
nil
end
end
# Plugin Hotspot to display the average rating
def display_community_average_rating community
unless community.nil?
average_rating = CommunityRating.average_rating community.id
Proc::new {
render :file => 'hotspots/display_community_average_rating',
:locals => {
:profile_identifier => community.identifier,
:average_rating => average_rating
}
}
end
end
def self.extra_blocks
{
CommunitiesRatingsBlock => { :type => [Community], :position => ['1']}
}
end
def stylesheet?
true
end
def js_files
%w(
public/rate.js
public/comunities_rating_management.js
)
end
end