Commit c791e21b9c98474f40260515a3d8a420c891c323
Committed by
Luciano Prestes
1 parent
0200c85d
Exists in
master
and in
5 other branches
Remove software and institution from community search
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Parley Martins <parley@outlook.com>
Showing
1 changed file
with
16 additions
and
0 deletions
Show diff stats
lib/mpog_software_plugin.rb
... | ... | @@ -138,6 +138,22 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
138 | 138 | @searches[@asset] = {:results => results} |
139 | 139 | @search = results |
140 | 140 | render :action => :communities |
141 | + #FIXME: Careful while merginging, this else must be the default action | |
142 | + else | |
143 | + unfiltered_list = visible_profiles(Community).select{ |com| com.name =~ /#{params[:query]}/} | |
144 | + list_without_software_and_institution = [] | |
145 | + unfiltered_list.each do |p| | |
146 | + if p.class == Community and !p.software? and !p.institution? | |
147 | + list_without_software_and_institution << p | |
148 | + end | |
149 | + end | |
150 | + | |
151 | + results = list_without_software_and_institution | |
152 | + | |
153 | + results = results.paginate(:per_page => 24, :page => params[:page]) | |
154 | + @searches[@asset] = {:results => results} | |
155 | + @search = results | |
156 | + render :action => :communities | |
141 | 157 | end |
142 | 158 | end |
143 | 159 | ... | ... |