Commit e47b6473 authored by Brice Sanchez's avatar Brice Sanchez Committed by Brice Sanchez
Browse files

Use ascii fields for UTF-8 search terms in Page

parent 9282f419
require 'acts_as_indexed'
require 'stringex_lite'
begin
Refinery::Page.class_eval do
# Docs for acts_as_indexed https://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:title, :meta_description,
:menu_title, :browser_title, :all_page_part_content]
acts_as_indexed :fields => [:ascii_title, :meta_description,
:menu_title, :browser_title, :ascii_all_page_part_content]
# Used to index all the content on this page so it can be easily searched.
def all_page_part_content
parts.map(&:body).join " "
end
private
def ascii_title
self.title.try(&:to_ascii)
end
def ascii_all_page_part_content
self.all_page_part_content.try(&:to_ascii)
end
end
rescue NameError
end
require 'acts_as_indexed'
require 'stringex_lite'
require 'refinerycms-core'
require 'refinery/acts_as_indexed'
......@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = %q{refinerycms-acts-as-indexed}
s.version = %q{2.0.1}
s.version = %q{3.0.0}
s.description = %q{An extension to handle the integration of Refinery CMS and ActsAsIndexed}
s.summary = %q{Refinery CMS ActsAsIndexed integration plugin}
s.email = %q{info@refinerycms.com}
......@@ -16,4 +16,5 @@ Gem::Specification.new do |s|
s.add_dependency 'refinerycms-core', ['>= 3.0.0', '< 4.0']
s.add_dependency 'acts_as_indexed', '~> 0.8.0'
s.add_dependency 'decorators', '~> 2.0.0'
s.add_dependency 'stringex', '~> 2.5.2'
end
......@@ -46,14 +46,14 @@ module Refinery
describe "pages extension" do
before do
FactoryGirl.create(:page, :title => "Ugis Ozols")
FactoryGirl.create(:page, :title => "Téléphone")
visit refinery.admin_pages_path
end
it "returns found page" do
fill_in "search", :with => "ugis"
fill_in "search", :with => "Telephone"
click_button "Search"
expect(page).to have_content("Ugis Ozols")
expect(page).to have_content("Téléphone")
end
it_behaves_like "no result search"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment