[Git][noosfero/noosfero][master] 3 commits: Remove OrganizationRatings#content

Bráulio Bhavamitra gitlab at mg.gitlab.com
Sat Apr 30 10:04:18 BRT 2016


Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero


Commits:
66eabb2c by Rafael Reggiani Manzo at 2016-04-30T09:25:27-03:00
Remove OrganizationRatings#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.

- - - - -
858ea0f0 by Rafael Reggiani Manzo at 2016-04-30T09:47:36-03:00
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.

- - - - -
c1b2bd5d by Bráulio Bhavamitra at 2016-04-30T13:04:04+00:00
Merge branch 'refactor_organization_ratings' into 'master'

Refactor organization ratings

This plugin has two block for which the `content` methods were remove in favour of the structure provided by `BoxesHelper`. View renames were necessary to meet the expected standards there.

Travis build: https://travis-ci.org/rafamanzo/noosfero/builds/126873754

See merge request !884
- - - - -


4 changed files:

- plugins/organization_ratings/lib/average_rating_block.rb
- plugins/organization_ratings/lib/organization_ratings_block.rb
- plugins/organization_ratings/views/blocks/display_organization_average_rating.html.erb → plugins/organization_ratings/views/blocks/average_rating.html.erb
- plugins/organization_ratings/views/blocks/organization_ratings_block.html.erb → plugins/organization_ratings/views/blocks/organization_ratings.html.erb


Changes:

=====================================
plugins/organization_ratings/lib/average_rating_block.rb
=====================================
--- 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


=====================================
plugins/organization_ratings/lib/organization_ratings_block.rb
=====================================
--- a/plugins/organization_ratings/lib/organization_ratings_block.rb
+++ b/plugins/organization_ratings/lib/organization_ratings_block.rb
@@ -9,17 +9,6 @@ class OrganizationRatingsBlock < Block
     _('This block displays the organization ratings.')
   end
 
-  def content(args = {})
-    block = self
-
-    proc do
-      render(
-        :file => 'blocks/organization_ratings_block',
-        :locals => {:block => block}
-      )
-    end
-  end
-
   def limit_number_of_ratings
     env_organization_ratings_config.per_page
   end


=====================================
plugins/organization_ratings/views/blocks/display_organization_average_rating.html.erb → plugins/organization_ratings/views/blocks/average_rating.html.erb
=====================================
--- a/plugins/organization_ratings/views/blocks/display_organization_average_rating.html.erb
+++ b/plugins/organization_ratings/views/blocks/average_rating.html.erb
@@ -1,3 +1,5 @@
+<% average_rating = OrganizationRating.average_rating block.owner.id %>
+
 <div class="organization-average-rating-container">
   <% if average_rating %>
     <div class="star-rate-text">
@@ -20,6 +22,6 @@
   <% end %>
 
   <div class="rate-this-organization">
-    <%= link_to _("Rate this %s") % _(profile.class.name), url_for(:controller => "organization_ratings_plugin_profile", :action => "new_rating", :profile=>profile_identifier) %>
+    <%= link_to _("Rate this %s") % _(block.owner.class.name), url_for(:controller => "organization_ratings_plugin_profile", :action => "new_rating", :profile => block.owner.identifier) %>
   </div>
 </div>
\ No newline at end of file


=====================================
plugins/organization_ratings/views/blocks/organization_ratings_block.html.erb → plugins/organization_ratings/views/blocks/organization_ratings.html.erb
=====================================
--- a/plugins/organization_ratings/views/blocks/organization_ratings_block.html.erb
+++ b/plugins/organization_ratings/views/blocks/organization_ratings.html.erb



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/b9867847602dec0cfd35217da3c35c167c4248bc...c1b2bd5d6a13b014dd2786021d0c625e95256559
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160430/6cf674aa/attachment-0001.html>


More information about the Noosfero-dev mailing list