From 0f51cb8bc95154136571c6ef1583b7bd1c302251 Mon Sep 17 00:00:00 2001 From: Gabriela Navarro Date: Wed, 6 May 2015 14:40:59 +0000 Subject: [PATCH] Fix "view all" from communities/software/institution block to show only the related organization --- lib/ext/profile_controller.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+), 0 deletions(-) create mode 100644 lib/ext/profile_controller.rb diff --git a/lib/ext/profile_controller.rb b/lib/ext/profile_controller.rb new file mode 100644 index 0000000..cd72996 --- /dev/null +++ b/lib/ext/profile_controller.rb @@ -0,0 +1,21 @@ +require_dependency 'profile_controller' + +class ProfileController + + def communities + type = [] + if params[:type] == "Software" + type = profile.softwares + elsif params[:type] == "Institution" + type = profile.institutions + else + profile.communities.select do |community| + type << community unless community.software? || community.institution? + end + end + + if is_cache_expired?(profile.communities_cache_key(params)) + @communities = type.paginate(:per_page => per_page, :page => params[:npage], :total_entries => type.count) + end + end +end -- libgit2 0.21.2