diff --git a/Gemfile.lock b/Gemfile.lock index aa6289dd..06fd266c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/lib/locomotive/core_ext.rb b/lib/locomotive/core_ext.rb index ca911d2b..276eb005 100644 --- a/lib/locomotive/core_ext.rb +++ b/lib/locomotive/core_ext.rb @@ -5,7 +5,7 @@ class String #:nodoc def permalink - self.parameterize('-') + self.to_ascii.parameterize('-') end def permalink! diff --git a/lib/locomotive/dependencies.rb b/lib/locomotive/dependencies.rb index 581d3da3..57c06bfb 100644 --- a/lib/locomotive/dependencies.rb +++ b/lib/locomotive/dependencies.rb @@ -19,6 +19,7 @@ require 'cancan' require 'RMagick' require 'cells' require 'sanitize' +require 'unidecoder' require 'compass' require 'codemirror/rails' diff --git a/locomotive_cms.gemspec b/locomotive_cms.gemspec index 5bec1508..674e31d3 100755 --- a/locomotive_cms.gemspec +++ b/locomotive_cms.gemspec @@ -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' @@ -77,4 +78,4 @@ Gem::Specification.new do |s| 'README.textile' ] -end \ No newline at end of file +end diff --git a/spec/models/locomotive/content_entry_spec.rb b/spec/models/locomotive/content_entry_spec.rb index 08794995..5063e6f4 100644 --- a/spec/models/locomotive/content_entry_spec.rb +++ b/spec/models/locomotive/content_entry_spec.rb @@ -148,7 +148,7 @@ describe Locomotive::ContentEntry do @content_entry.title = "my.test"; @content_entry.send(:set_slug) @content_entry._permalink.should == 'my-test' end - + it 'accepts non-latin chars' do @content_entry.title = "абракадабра"; @content_entry.send(:set_slug) @content_entry._permalink.should == 'abrakadabra' diff --git a/spec/models/locomotive/page_spec.rb b/spec/models/locomotive/page_spec.rb index ce035261..cbcf4ea6 100644 --- a/spec/models/locomotive/page_spec.rb +++ b/spec/models/locomotive/page_spec.rb @@ -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 diff --git a/spec/models/locomotive/snippet_spec.rb b/spec/models/locomotive/snippet_spec.rb index bfa8cf15..274fee6e 100644 --- a/spec/models/locomotive/snippet_spec.rb +++ b/spec/models/locomotive/snippet_spec.rb @@ -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