Commit 43df1ac849a41449fa68c159c23e973688536aef
Committed by
Álvaro Fernando Matos de Souza
1 parent
3474fc2c
Exists in
master
and in
5 other branches
Display average rating on community's main page
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Pedro de Lyra <pedrodelyra@gmail.com>
Showing
3 changed files
with
8 additions
and
22 deletions
Show diff stats
lib/software_communities_plugin.rb
... | ... | @@ -70,6 +70,12 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin |
70 | 70 | ) |
71 | 71 | end |
72 | 72 | |
73 | + module Hotspots | |
74 | + def display_community_average_rating community | |
75 | + nil | |
76 | + end | |
77 | + end | |
78 | + | |
73 | 79 | def communities_ratings_plugin_comments_extra_fields |
74 | 80 | if context.profile.software? |
75 | 81 | Proc::new { render :file => 'comments_extra_fields' } | ... | ... |
lib/software_information_block.rb
... | ... | @@ -15,12 +15,11 @@ class SoftwareInformationBlock < Block |
15 | 15 | def content(args={}) |
16 | 16 | block = self |
17 | 17 | s = show_name |
18 | - average_rating = CommunityRating.average_rating block.owner.id | |
19 | 18 | |
20 | 19 | lambda do |object| |
21 | 20 | render( |
22 | 21 | :file => 'blocks/software_information', |
23 | - :locals => { :block => block, :show_name => s, :average_rating => average_rating} | |
22 | + :locals => { :block => block, :show_name => s} | |
24 | 23 | ) |
25 | 24 | end |
26 | 25 | end | ... | ... |
views/blocks/software_information.html.erb
... | ... | @@ -27,27 +27,8 @@ |
27 | 27 | <b> |
28 | 28 | <%= block.owner.software_info.finality %> |
29 | 29 | </b> |
30 | - <div class="community-average-rating-container"> | |
31 | - <% if average_rating %> | |
32 | - <div class="star-rate-text"><%= _("Rate") %></div> | |
33 | 30 | |
34 | - <div class="star-container"> | |
35 | - <% (1..5).each do |star_number| %> | |
36 | - <% if star_number <= average_rating %> | |
37 | - <div class="medium-star-positive"></div> | |
38 | - <% else %> | |
39 | - <div class="medium-star-negative"></div> | |
40 | - <% end %> | |
41 | - <% end %> | |
42 | - </div> | |
43 | - <% else %> | |
44 | - <%= _("Be the first to rate this software") %> | |
45 | - <% end %> | |
46 | - | |
47 | - <div class="rate-this-software"> | |
48 | - <%= link_to _('Rate this software'), url_for(:controller => 'communities_ratings_plugin_profile', :action => 'new_rating', :profile=>block.owner.identifier) %> | |
49 | - </div> | |
50 | - </div> | |
31 | + <%= @plugins.dispatch(:display_community_average_rating, block.owner).collect { |content| instance_exec(&content) }.join("") %> | |
51 | 32 | </td> |
52 | 33 | </tr> |
53 | 34 | </table> | ... | ... |