[Git][noosfero/noosfero][master] 2 commits: fixes type for admin panel organizations list
Marcos Ronaldo Pereira Junior
gitlab at mg.gitlab.com
Fri Apr 1 07:43:30 BRT 2016
Marcos Ronaldo Pereira Junior pushed to branch master at Noosfero / noosfero
Commits:
bda47639 by Marcos Ronaldo at 2016-03-31T22:42:12-03:00
fixes type for admin panel organizations list
Signed-off-by: Alexandre Barbosa <alexandreab at live.com>
Signed-off-by: ArthurJahn <stutrzbecher at gmail.com>
Signed-off-by: Marcos Ronaldo <marcos.rpj2 at gmail.com>
- - - - -
12ab2e97 by Marcos Ronaldo Pereira Junior at 2016-04-01T10:42:56+00:00
Merge branch 'fix_admin_organization_list' into 'master'
fixes type for admin panel organization list
Fix hotspot organization_types_filter_options, and show human readable name on view ,without the plugin namespace.
Signed-off-by: Alexandre Barbosa <alexandreab at live.com>
Signed-off-by: ArthurJahn <stutrzbecher at gmail.com>
Signed-off-by: Marcos Ronaldo <marcos.rpj2 at gmail.com>
See merge request !813
- - - - -
3 changed files:
- app/controllers/admin/organizations_controller.rb
- app/views/organizations/_results.html.erb
- test/functional/organizations_controller_test.rb
Changes:
=====================================
app/controllers/admin/organizations_controller.rb
=====================================
--- 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?
=====================================
app/views/organizations/_results.html.erb
=====================================
--- a/app/views/organizations/_results.html.erb
+++ b/app/views/organizations/_results.html.erb
@@ -30,7 +30,7 @@
</div>
</td>
- <td> <%= _(p.type) %> </td>
+ <td> <%= @types_hash[p.type] %> </td>
</tr>
<% end %>
</table>
=====================================
test/functional/organizations_controller_test.rb
=====================================
--- 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?
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/5b115b7a5a0aff158c3622a5879472596c6b61dd...12ab2e97c9699e8d7586ab16e370dfb6c2ef54bf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160401/908e8266/attachment-0001.html>
More information about the Noosfero-dev
mailing list