Use unidecoder for converting non ascii charcters for page slugs. Fixes #340
This commit is contained in:
parent
22d55cf0e0
commit
f74306503b
@ -62,7 +62,7 @@ PATH
|
||||
responders (~> 0.6.4)
|
||||
rmagick (~> 2.12.2)
|
||||
sanitize (~> 2.0.3)
|
||||
stringex (~> 1.3.2)
|
||||
unidecoder (~> 1.1.1)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
@ -298,7 +298,6 @@ GEM
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
stringex (1.3.2)
|
||||
term-ansicolor (1.0.7)
|
||||
thor (0.14.6)
|
||||
tilt (1.3.3)
|
||||
@ -313,6 +312,7 @@ GEM
|
||||
kgio (~> 2.6)
|
||||
rack
|
||||
raindrops (~> 0.7)
|
||||
unidecoder (1.1.1)
|
||||
warden (1.1.1)
|
||||
rack (>= 1.0)
|
||||
xpath (0.1.4)
|
||||
|
@ -5,7 +5,7 @@
|
||||
class String #:nodoc
|
||||
|
||||
def permalink
|
||||
self.parameterize('-')
|
||||
self.to_ascii.parameterize('-')
|
||||
end
|
||||
|
||||
def permalink!
|
||||
|
@ -19,6 +19,7 @@ require 'cancan'
|
||||
require 'RMagick'
|
||||
require 'cells'
|
||||
require 'sanitize'
|
||||
require 'unidecoder'
|
||||
|
||||
require 'compass'
|
||||
require 'codemirror/rails'
|
||||
|
@ -49,6 +49,7 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency 'RedCloth', '~> 4.2.8'
|
||||
s.add_dependency 'sanitize', '~> 2.0.3'
|
||||
s.add_dependency 'highline', '~> 1.6.2'
|
||||
s.add_dependency 'unidecoder', '~> 1.1.1'
|
||||
|
||||
s.add_dependency 'rmagick', '~> 2.12.2'
|
||||
s.add_dependency 'carrierwave-mongoid', '~> 0.1.3'
|
||||
|
@ -235,7 +235,7 @@ describe Locomotive::Page do
|
||||
|
||||
it 'fills in the slug field' do
|
||||
@page.valid?
|
||||
@page.slug.should == 'content-type-template'
|
||||
@page.slug.should == 'content_type_template'
|
||||
end
|
||||
|
||||
it 'returns the target klass' do
|
||||
|
@ -20,13 +20,13 @@ describe Locomotive::Snippet do
|
||||
|
||||
before :each do
|
||||
@site = FactoryGirl.create(:site, :subdomain => 'omg')
|
||||
@snippet = FactoryGirl.create(:snippet, :site => @site, :slug => 'my-test-snippet', :template => 'a testing template')
|
||||
@snippet = FactoryGirl.create(:snippet, :site => @site, :slug => 'my_test_snippet', :template => 'a testing template')
|
||||
end
|
||||
|
||||
context 'with a normal top level snippet' do
|
||||
|
||||
before :each do
|
||||
@page = FactoryGirl.create(:page, :site => @site, :slug => 'my_page_here', :raw_template => "{% include 'my-test-snippet' %}")
|
||||
@page = FactoryGirl.create(:page, :site => @site, :slug => 'my_page_here', :raw_template => "{% include 'my_test_snippet' %}")
|
||||
end
|
||||
|
||||
it 'updates templates with the new snippet template' do
|
||||
@ -39,7 +39,7 @@ describe Locomotive::Snippet do
|
||||
context 'for snippets inside of a block' do
|
||||
|
||||
before :each do
|
||||
@page = FactoryGirl.create(:page, :site => @site, :slug => 'my_page_here', :raw_template => "{% block main %}{% include 'my-test-snippet' %}{% endblock %}")
|
||||
@page = FactoryGirl.create(:page, :site => @site, :slug => 'my_page_here', :raw_template => "{% block main %}{% include 'my_test_snippet' %}{% endblock %}")
|
||||
end
|
||||
|
||||
it 'updates templates with the new snippet template' do
|
||||
@ -54,7 +54,7 @@ describe Locomotive::Snippet do
|
||||
before :each do
|
||||
Mongoid::Fields::I18n.with_locale(:fr) do
|
||||
@snippet = FactoryGirl.create(:snippet, :site => @site, :slug => 'my_localized_test_snippet', :template => 'a testing template')
|
||||
@page = FactoryGirl.create(:page, :site => @site, :slug => 'my_localized_test_snippet', :raw_template => "{% block main %}{% include 'my-localized-test-snippet' %}{% endblock %}")
|
||||
@page = FactoryGirl.create(:page, :site => @site, :slug => 'my_localized_test_snippet', :raw_template => "{% block main %}{% include 'my_localized_test_snippet' %}{% endblock %}")
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user