diff --git a/plugins/organization_ratings/lib/average_rating_block.rb b/plugins/organization_ratings/lib/average_rating_block.rb index 5e0e378..d07ef5c 100644 --- a/plugins/organization_ratings/lib/average_rating_block.rb +++ b/plugins/organization_ratings/lib/average_rating_block.rb @@ -9,20 +9,20 @@ class AverageRatingBlock < Block _('This block displays the organization average rating.') end - def content(args = {}) - profile_identifier = self.owner.identifier - average_rating = OrganizationRating.average_rating self.owner.id + # def content(args = {}) + # profile_identifier = self.owner.identifier + # average_rating = OrganizationRating.average_rating self.owner.id - proc do - render( - :file => 'blocks/display_organization_average_rating', - :locals => { - :profile_identifier => profile_identifier, - :average_rating => average_rating - } - ) - end - end + # proc do + # render( + # :file => 'blocks/display_organization_average_rating', + # :locals => { + # :profile_identifier => profile_identifier, + # :average_rating => average_rating + # } + # ) + # end + # end def cacheable? false diff --git a/plugins/organization_ratings/views/blocks/average_rating.html.erb b/plugins/organization_ratings/views/blocks/average_rating.html.erb new file mode 100644 index 0000000..f44c3d2 --- /dev/null +++ b/plugins/organization_ratings/views/blocks/average_rating.html.erb @@ -0,0 +1,27 @@ +<% average_rating = OrganizationRating.average_rating block.owner.id %> + +
+ <% if average_rating %> +
+ <%= _("Rating: ") %> +
+ +
+ <% (1..5).each do |star_number| %> + <% if star_number <= average_rating %> +
+ <% else %> +
+ <% end %> + <% end %> +
+ <% else %> +
+ <%= _("Be the first to rate!") %> +
+ <% end %> + +
+ <%= link_to _("Rate this %s") % _(block.owner.class.name), url_for(:controller => "organization_ratings_plugin_profile", :action => "new_rating", :profile => block.owner.identifier) %> +
+
\ No newline at end of file diff --git a/plugins/organization_ratings/views/blocks/display_organization_average_rating.html.erb b/plugins/organization_ratings/views/blocks/display_organization_average_rating.html.erb deleted file mode 100644 index 32d25f3..0000000 --- a/plugins/organization_ratings/views/blocks/display_organization_average_rating.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -
- <% if average_rating %> -
- <%= _("Rating: ") %> -
- -
- <% (1..5).each do |star_number| %> - <% if star_number <= average_rating %> -
- <% else %> -
- <% end %> - <% end %> -
- <% else %> -
- <%= _("Be the first to rate!") %> -
- <% end %> - -
- <%= link_to _("Rate this %s") % _(profile.class.name), url_for(:controller => "organization_ratings_plugin_profile", :action => "new_rating", :profile=>profile_identifier) %> -
-
\ No newline at end of file -- libgit2 0.21.2