Sha256: 6da97357bf218d6e6856cd5606fff567f56e0823fbd798b6cddad29f134945bd
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
class <%= camelcased_class_name %> < Hancock::Search::SearchController # def index # return redirect_to url_for(params) if search_redirecter # # if Hancock::Search.config.breadcrumbs_on_rails_support # add_breadcrumb "search", [:hancock_search], if: :insert_breadcrumbs # add_breadcrumb "results", [:hancock_search, {q: params[:q]}], if: :insert_breadcrumbs # end # # if params[:q].blank? # @results = [] # else # @results = search_scope ? search_scope.page(params[:page]).per(per_page).send(fts_method, query) : [] # end # end # # private # def search_model_class # Hancock::Pages::Page if Hancock::Search.config.pages_support # end # # def search_scope # search_model_class.enabled if search_model_class # end # # def fts_method # :fts # end # # def search_redirecter # if params[:utf8].present? or params[:submit].present? or params[:commit].present? # params.delete(:utf8) # params.delete(:submit) # params.delete(:commit) # return true # end # false # end # # def insert_breadcrumbs # true # end # # def per_page # 10 # end # # def query # params[:q].to_s.gsub(/\P{Word}+/, ' ').gsub(/ +/, ' ').strip # end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hancock_cms_search-1.0.2 | lib/generators/hancock/search/controllers/templates/search.erb |