Commit 2616a41c475ccab4cec1f593f1e1509b58f91bf4
1 parent
2867a315
Exists in
master
and in
5 other branches
Remove people search filter, fix searchs
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com> Signed-off-by: Gustavo Jaruga <darksshades@gmail.com>
Showing
2 changed files
with
12 additions
and
44 deletions
Show diff stats
lib/mpog_software_plugin.rb
| ... | ... | @@ -104,6 +104,17 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
| 104 | 104 | @searches[@asset] = {:results => results} |
| 105 | 105 | @search = results |
| 106 | 106 | render :action => :communities |
| 107 | + elsif params[:type] == "Institution" | |
| 108 | + institutions = Institution.search_institution(params[:intitution_name]) | |
| 109 | + communities = [] | |
| 110 | + institutions.each do |s| | |
| 111 | + communities << s.community | |
| 112 | + end | |
| 113 | + results = communities | |
| 114 | + results = results.paginate(:per_page => 24, :page => params[:page]) | |
| 115 | + @searches[@asset] = {:results => results} | |
| 116 | + @search = results | |
| 117 | + render :action => :communities | |
| 107 | 118 | #FIXME: Careful while merginging, this else must be the default action |
| 108 | 119 | else |
| 109 | 120 | unfiltered_list = visible_profiles(Community).select{ |com| com.name =~ /#{params[:query]}/} |
| ... | ... | @@ -122,18 +133,6 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
| 122 | 133 | render :action => :communities |
| 123 | 134 | end |
| 124 | 135 | |
| 125 | - if params[:type] == "Institution" | |
| 126 | - institutions = Institution.search_institution(params[:intitution_name]) | |
| 127 | - communities = [] | |
| 128 | - institutions.each do |s| | |
| 129 | - communities << s.community | |
| 130 | - end | |
| 131 | - results = communities | |
| 132 | - results = results.paginate(:per_page => 24, :page => params[:page]) | |
| 133 | - @searches[@asset] = {:results => results} | |
| 134 | - @search = results | |
| 135 | - render :action => :communities | |
| 136 | - end | |
| 137 | 136 | end |
| 138 | 137 | |
| 139 | 138 | people_block = proc do |
| ... | ... | @@ -415,9 +414,7 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
| 415 | 414 | end |
| 416 | 415 | |
| 417 | 416 | def add_new_search_filter |
| 418 | - if context.params[:action] == "people" | |
| 419 | - expanded_template('search/search_user_filter.html.erb') | |
| 420 | - elsif context.params[:action] == "communities" | |
| 417 | + if context.params[:action] == "communities" | |
| 421 | 418 | @active_type = if context.params[:type] == "Software" |
| 422 | 419 | "software" |
| 423 | 420 | elsif context.params[:type] == "Institution" | ... | ... |
views/search/search_user_filter.html.erb
| ... | ... | @@ -1,29 +0,0 @@ |
| 1 | -<form action="/search/people" name="user_filter" method="POST" class="search_form"> | |
| 2 | - <div id="user_filter_content"> | |
| 3 | - <div class="mpog_search_form_fields"> | |
| 4 | - | |
| 5 | - <table class="mpog_search_form_table"> | |
| 6 | - <tr> | |
| 7 | - <td> <%= label_tag :name, _("Name") %> </td> | |
| 8 | - <td> <%= text_field_tag :name %> </td> | |
| 9 | - </tr> | |
| 10 | - <tr> | |
| 11 | - <td> <%= label_tag :state, _("State") %> </td> | |
| 12 | - <td> <%= text_field_tag :state %> </td> | |
| 13 | - </tr> | |
| 14 | - <tr> | |
| 15 | - <td> <%= label_tag :city, _("City") %> </td> | |
| 16 | - <td> <%= text_field_tag :city %> </td> | |
| 17 | - </tr> | |
| 18 | - <tr> | |
| 19 | - <td> <%= label_tag :email, _("Email") %> </td> | |
| 20 | - <td> <%= text_field_tag :email %> </td> | |
| 21 | - </tr> | |
| 22 | - <tr> | |
| 23 | - <td> </td> | |
| 24 | - <td> <%= submit_button(:search, _('Search')) %> </td> | |
| 25 | - </tr> | |
| 26 | - </table> | |
| 27 | - </div> | |
| 28 | - </div> | |
| 29 | -</form> | |
| 30 | 0 | \ No newline at end of file |