Commit 14293f6a70e144230be45ab05665255a036383c9
1 parent
49381d9f
Exists in
master
and in
5 other branches
Add catalog of institutions
Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
6 changed files
with
52 additions
and
4 deletions
Show diff stats
lib/ext/search_controller.rb
| ... | ... | @@ -9,6 +9,16 @@ class SearchController |
| 9 | 9 | @search = results |
| 10 | 10 | end |
| 11 | 11 | |
| 12 | + def institutions | |
| 13 | + @titles[:institutions] = _("Institution Catalog") | |
| 14 | + @category_filters = [] | |
| 15 | + results = filter_communities_list{|community| community.institution?} | |
| 16 | + results = results.paginate(:per_page => 24, :page => params[:page]) | |
| 17 | + @searches[@asset] = {:results => results} | |
| 18 | + @search = results | |
| 19 | + end | |
| 20 | + | |
| 21 | + | |
| 12 | 22 | def software_infos |
| 13 | 23 | @titles[:software_infos] = _("Software Catalog") |
| 14 | 24 | @category_filters = [] |
| ... | ... | @@ -40,4 +50,4 @@ class SearchController |
| 40 | 50 | end |
| 41 | 51 | communities_list |
| 42 | 52 | end |
| 43 | -end | |
| 44 | 53 | \ No newline at end of file |
| 54 | +end | ... | ... |
lib/ext/search_helper.rb
lib/institution.rb
lib/software_info.rb
| 1 | 1 | class SoftwareInfo < ActiveRecord::Base |
| 2 | 2 | SEARCH_FILTERS = [] |
| 3 | - SEARCH_DISPLAYS = %w[full] | |
| 3 | + SEARCH_DISPLAYS = %w[compact] | |
| 4 | 4 | |
| 5 | 5 | def self.default_search_display |
| 6 | - 'full' | |
| 6 | + 'compact' | |
| 7 | 7 | end |
| 8 | 8 | |
| 9 | 9 | attr_accessible :e_mag, :icp_brasil, :intern, :e_ping, :e_arq, :operating_platform | ... | ... |
test/functional/search_controller_test.rb
| ... | ... | @@ -58,4 +58,15 @@ class SearchControllerTest < ActionController::TestCase |
| 58 | 58 | assert_not_includes assigns(:searches)[:software_infos][:results], software_without_category.community |
| 59 | 59 | end |
| 60 | 60 | |
| 61 | + should "institutions_search don't have community or software" do | |
| 62 | + community = create_community("New Community") | |
| 63 | + software = create_software_info("New Software") | |
| 64 | + institution = create_private_institution("New Private Institution", "NPI" , "Brazil", "DF", "Gama", "66.544.314/0001-63") | |
| 65 | + | |
| 66 | + get :institutions, :query => "New" | |
| 67 | + | |
| 68 | + assert_includes assigns(:searches)[:institutions][:results], institution.community | |
| 69 | + assert_not_includes assigns(:searches)[:institutions][:results], community | |
| 70 | + assert_not_includes assigns(:searches)[:institutions][:results], software.community | |
| 71 | + end | |
| 61 | 72 | end | ... | ... |
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +<%= search_page_title( @titles[@asset], @category ) %> | |
| 2 | + | |
| 3 | +<%= render :partial => 'search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> | |
| 4 | + | |
| 5 | +<%= render :partial => 'results_header' %> | |
| 6 | + | |
| 7 | +<%= display_results(@searches, @asset) %> | |
| 8 | +<% if params[:display] != 'map' %> | |
| 9 | + <%= pagination_links @searches[@asset][:results] %> | |
| 10 | +<% end %> | |
| 11 | + | |
| 12 | +<div style="clear: both"></div> | |
| 13 | + | |
| 14 | +<% if @asset == :product %> | |
| 15 | + <%= javascript_tag do %> | |
| 16 | + jQuery('.search-product-price-details').altBeautify(); | |
| 17 | + <% end %> | |
| 18 | +<% end %> | ... | ... |