From 861eeeb7d110f8970ac2aa5e198fb7ee4f8a3e03 Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Sat, 30 Apr 2016 08:54:24 -0300 Subject: [PATCH] Refactor sub_organizations plugin Block --- plugins/sub_organizations/lib/related_organizations_block.rb | 10 ---------- plugins/sub_organizations/views/blocks/footers/related_organizations.html.erb | 8 ++++++++ 2 files changed, 8 insertions(+), 10 deletions(-) create mode 100644 plugins/sub_organizations/views/blocks/footers/related_organizations.html.erb diff --git a/plugins/sub_organizations/lib/related_organizations_block.rb b/plugins/sub_organizations/lib/related_organizations_block.rb index 7222c69..53622fa 100644 --- a/plugins/sub_organizations/lib/related_organizations_block.rb +++ b/plugins/sub_organizations/lib/related_organizations_block.rb @@ -39,16 +39,6 @@ class RelatedOrganizationsBlock < ProfileListBlock end end - def footer - profile = self.owner - type = self.organization_type - params = {:profile => profile.identifier, :controller => 'sub_organizations_plugin_profile', :action => display_type[:action]} - params[:type] = type if type == 'enterprise' || type == 'community' - proc do - link_to c_('View all'), params.merge(params) - end - end - def related_organizations profile = self.owner organizations = Organization.parents(profile) diff --git a/plugins/sub_organizations/views/blocks/footers/related_organizations.html.erb b/plugins/sub_organizations/views/blocks/footers/related_organizations.html.erb new file mode 100644 index 0000000..f51ed43 --- /dev/null +++ b/plugins/sub_organizations/views/blocks/footers/related_organizations.html.erb @@ -0,0 +1,8 @@ +<%= link_to c_('View all'), + { + profile: block.owner.identifier, + controller: 'sub_organizations_plugin_profile', + action: block.display_type[:action], + type: ((block.organization_type == 'enterprise' || block.organization_type == 'community') ? block.organization_type : nil) + } +%> -- libgit2 0.21.2