Created
February 7, 2012 20:00
-
-
Save mokevnin/1761544 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Web::Realty::SearchesController < Web::Realty::ApplicationController | |
| before_filter do | |
| add_breadcrumb t('realty.menu.finder'), realty_search_path | |
| end | |
| def show | |
| total_facets | |
| static_info | |
| end | |
| def results | |
| total_facets | |
| static_info | |
| @regions = W::Geo.main_regions | |
| @search = SearchFilters::Realty.new(params[:realty]) | |
| options = @search.search_options.merge( :pagination => {:page => params[:page], :per => params[:per_page]}, :per_page => 1000 ) | |
| @objects = W::Realty.search(options) | |
| facets_options = @search.facets_options | |
| @facets = ::Realty.facets(facets_options) | |
| @facets = @facets[:region_id] | |
| @facets[:all] = eval @facets.values.compact.join('+') | |
| #geo_ids = @regions.map { |r| r.id if @facets[r.id] } | |
| #geo_ids = geo_ids.compact | |
| #@search.geo_id = geo_ids.first | |
| end | |
| private | |
| def total_facets | |
| search = SearchFilters::Realty.new | |
| @total_facets = ::Realty.facets search.facets_options | |
| @total_facets = @total_facets[:region_id] | |
| @total_facets[:all] = eval @total_facets.values.compact.join('+') | |
| end | |
| def static_info | |
| @companies_count = W::Company.count | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment