diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb
index 25f413c..8b37935 100644
--- a/app/controllers/admin/organizations_controller.rb
+++ b/app/controllers/admin/organizations_controller.rb
@@ -7,7 +7,11 @@ class OrganizationsController < AdminController
@title = _('Organization profiles')
@type = params[:type] || "any"
@types_filter = [[_('All'), 'any'], [_('Community'), 'Community'], [_('Enterprise'), 'Enterprise']]
- @types_filter = @types_filter | @plugins.dispatch(:organization_types_filter_options)
+ @plugins.dispatch_without_flatten(:organization_types_filter_options).each do |plugin_response|
+ @types_filter = @types_filter | plugin_response
+ end
+ @types_hash = {}
+ @types_filter.each{|list| @types_hash[list.last] = list.first}
scope = @plugins.dispatch_first(:filter_manage_organization_scope, @type)
if scope.blank?
diff --git a/app/views/organizations/_results.html.erb b/app/views/organizations/_results.html.erb
index 85369e0..ae3a638 100644
--- a/app/views/organizations/_results.html.erb
+++ b/app/views/organizations/_results.html.erb
@@ -30,7 +30,7 @@
-
<%= _(p.type) %> |
+ <%= @types_hash[p.type] %> |
<% end %>
diff --git a/test/functional/organizations_controller_test.rb b/test/functional/organizations_controller_test.rb
index 41ae764..dc8f4fa 100644
--- a/test/functional/organizations_controller_test.rb
+++ b/test/functional/organizations_controller_test.rb
@@ -79,6 +79,36 @@ class OrganizationsControllerTest < ActionController::TestCase
assert_match(/Community Test/, @response.body)
end
+ should 'show custom organization type filter through hotspot' do
+ fast_create(Community, :environment_id => Environment.default, :name=>"Community Test")
+
+ class GreatPlugin < Noosfero::Plugin
+ def organization_types_filter_options
+ [['TotallyDifferentName','GreatPlugin::GreatOrganization']]
+ end
+ end
+
+ class GreatPlugin::GreatOrganization < Organization
+ end
+
+ Noosfero::Plugin.stubs(:all).returns(['OrganizationsControllerTest::GreatPlugin'])
+ environment.enable_plugin(GreatPlugin)
+
+ GreatPlugin::GreatOrganization.create!(:name => 'Great', :identifier=>'great')
+
+ get :index, :type => 'any'
+
+ assert_tag :option, :attributes => {:value=> 'GreatPlugin::GreatOrganization'}, :content => 'TotallyDifferentName'
+
+ assert_match(/Great/, @response.body)
+ assert_match(/Community Test/, @response.body)
+
+ get :index, :type => 'GreatPlugin::GreatOrganization'
+
+ assert_match(/Great/, @response.body)
+ assert_no_match(/Community Test/, @response.body)
+ end
+
should 'activate organization profile' do
organization = fast_create(Organization, :visible => false, :environment_id => environment.id)
refute organization.visible?
--
libgit2 0.21.2