Commit 861eeeb7d110f8970ac2aa5e198fb7ee4f8a3e03
1 parent
b9867847
Exists in
send_email_to_admins
and in
5 other branches
Refactor sub_organizations plugin Block
The method footer was an instance of a model generating HTML and thus violating MVC. This has been refactored to use the new BoxesHelper structure for view rendering.
Showing
2 changed files
with
8 additions
and
10 deletions
Show diff stats
plugins/sub_organizations/lib/related_organizations_block.rb
| @@ -39,16 +39,6 @@ class RelatedOrganizationsBlock < ProfileListBlock | @@ -39,16 +39,6 @@ class RelatedOrganizationsBlock < ProfileListBlock | ||
| 39 | end | 39 | end |
| 40 | end | 40 | end |
| 41 | 41 | ||
| 42 | - def footer | ||
| 43 | - profile = self.owner | ||
| 44 | - type = self.organization_type | ||
| 45 | - params = {:profile => profile.identifier, :controller => 'sub_organizations_plugin_profile', :action => display_type[:action]} | ||
| 46 | - params[:type] = type if type == 'enterprise' || type == 'community' | ||
| 47 | - proc do | ||
| 48 | - link_to c_('View all'), params.merge(params) | ||
| 49 | - end | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | def related_organizations | 42 | def related_organizations |
| 53 | profile = self.owner | 43 | profile = self.owner |
| 54 | organizations = Organization.parents(profile) | 44 | organizations = Organization.parents(profile) |
plugins/sub_organizations/views/blocks/footers/related_organizations.html.erb
0 → 100644
| @@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
| 1 | +<%= link_to c_('View all'), | ||
| 2 | + { | ||
| 3 | + profile: block.owner.identifier, | ||
| 4 | + controller: 'sub_organizations_plugin_profile', | ||
| 5 | + action: block.display_type[:action], | ||
| 6 | + type: ((block.organization_type == 'enterprise' || block.organization_type == 'community') ? block.organization_type : nil) | ||
| 7 | + } | ||
| 8 | +%> |