Commit 858ea0f0b4354b394774ff23a90298f874346002

Authored by Rafael Reggiani Manzo
1 parent 66eabb2c

Remove AverageRating#content

This method is no longer necessary (and violates MVC) with the new
structure at BoxesHelper being enough for such job.

The view just required a rename to get into the standards.
plugins/organization_ratings/lib/average_rating_block.rb
@@ -9,20 +9,20 @@ class AverageRatingBlock < Block @@ -9,20 +9,20 @@ class AverageRatingBlock < Block
9 _('This block displays the organization average rating.') 9 _('This block displays the organization average rating.')
10 end 10 end
11 11
12 - def content(args = {})  
13 - profile_identifier = self.owner.identifier  
14 - average_rating = OrganizationRating.average_rating self.owner.id 12 + # def content(args = {})
  13 + # profile_identifier = self.owner.identifier
  14 + # average_rating = OrganizationRating.average_rating self.owner.id
15 15
16 - proc do  
17 - render(  
18 - :file => 'blocks/display_organization_average_rating',  
19 - :locals => {  
20 - :profile_identifier => profile_identifier,  
21 - :average_rating => average_rating  
22 - }  
23 - )  
24 - end  
25 - end 16 + # proc do
  17 + # render(
  18 + # :file => 'blocks/display_organization_average_rating',
  19 + # :locals => {
  20 + # :profile_identifier => profile_identifier,
  21 + # :average_rating => average_rating
  22 + # }
  23 + # )
  24 + # end
  25 + # end
26 26
27 def cacheable? 27 def cacheable?
28 false 28 false
plugins/organization_ratings/views/blocks/average_rating.html.erb 0 → 100644
@@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
  1 +<% average_rating = OrganizationRating.average_rating block.owner.id %>
  2 +
  3 +<div class="organization-average-rating-container">
  4 + <% if average_rating %>
  5 + <div class="star-rate-text">
  6 + <%= _("Rating: ") %>
  7 + </div>
  8 +
  9 + <div class="star-container">
  10 + <% (1..5).each do |star_number| %>
  11 + <% if star_number <= average_rating %>
  12 + <div class="medium-star-positive"></div>
  13 + <% else %>
  14 + <div class="medium-star-negative"></div>
  15 + <% end %>
  16 + <% end %>
  17 + </div>
  18 + <% else %>
  19 + <div class="rating-invitation">
  20 + <%= _("Be the first to rate!") %>
  21 + </div>
  22 + <% end %>
  23 +
  24 + <div class="rate-this-organization">
  25 + <%= link_to _("Rate this %s") % _(block.owner.class.name), url_for(:controller => "organization_ratings_plugin_profile", :action => "new_rating", :profile => block.owner.identifier) %>
  26 + </div>
  27 +</div>
0 \ No newline at end of file 28 \ No newline at end of file
plugins/organization_ratings/views/blocks/display_organization_average_rating.html.erb
@@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
1 -<div class="organization-average-rating-container">  
2 - <% if average_rating %>  
3 - <div class="star-rate-text">  
4 - <%= _("Rating: ") %>  
5 - </div>  
6 -  
7 - <div class="star-container">  
8 - <% (1..5).each do |star_number| %>  
9 - <% if star_number <= average_rating %>  
10 - <div class="medium-star-positive"></div>  
11 - <% else %>  
12 - <div class="medium-star-negative"></div>  
13 - <% end %>  
14 - <% end %>  
15 - </div>  
16 - <% else %>  
17 - <div class="rating-invitation">  
18 - <%= _("Be the first to rate!") %>  
19 - </div>  
20 - <% end %>  
21 -  
22 - <div class="rate-this-organization">  
23 - <%= link_to _("Rate this %s") % _(profile.class.name), url_for(:controller => "organization_ratings_plugin_profile", :action => "new_rating", :profile=>profile_identifier) %>  
24 - </div>  
25 -</div>  
26 \ No newline at end of file 0 \ No newline at end of file