Commit 0f51cb8bc95154136571c6ef1583b7bd1c302251
Committed by
Álvaro Fernando Matos de Souza
1 parent
f1368eda
Exists in
master
and in
5 other branches
Fix "view all" from communities/software/institution block to show only the related organization
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Showing
1 changed file
with
21 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
| 1 | +require_dependency 'profile_controller' | ||
| 2 | + | ||
| 3 | +class ProfileController | ||
| 4 | + | ||
| 5 | + def communities | ||
| 6 | + type = [] | ||
| 7 | + if params[:type] == "Software" | ||
| 8 | + type = profile.softwares | ||
| 9 | + elsif params[:type] == "Institution" | ||
| 10 | + type = profile.institutions | ||
| 11 | + else | ||
| 12 | + profile.communities.select do |community| | ||
| 13 | + type << community unless community.software? || community.institution? | ||
| 14 | + end | ||
| 15 | + end | ||
| 16 | + | ||
| 17 | + if is_cache_expired?(profile.communities_cache_key(params)) | ||
| 18 | + @communities = type.paginate(:per_page => per_page, :page => params[:npage], :total_entries => type.count) | ||
| 19 | + end | ||
| 20 | + end | ||
| 21 | +end |