merge pull request #300

This commit is contained in:
Didier Lafforgue 2012-03-03 15:06:50 +01:00
parent 9a25c06969
commit a8f422ba42
5 changed files with 4 additions and 3 deletions

2
.gitignore vendored
View File

@ -34,5 +34,5 @@ sites/
permanent permanent
doc/bushido doc/bushido
*.swp *.swp
/spec/dummy

View File

@ -45,7 +45,7 @@ module Locomotive
def replace_images!(template) def replace_images!(template)
return if template.blank? return if template.blank?
template.gsub!(/\/samples\/(.*\.[a-zA-Z0-9]{3})/) do |match| template.gsub!(/\/samples\/([^'"]+?\.[a-zA-Z0-9]{3})/) do |match|
name = File.basename($1) name = File.basename($1)
if asset = site.assets.where(:source_filename => name).first if asset = site.assets.where(:source_filename => name).first

View File

@ -113,6 +113,7 @@ module Locomotive
end end
end end
else else
self.replace_images!(attributes['content'])
element.content = attributes['content'] element.content = attributes['content']
end end
end end

Binary file not shown.

View File

@ -73,7 +73,7 @@ describe Locomotive::Import::Job do
it 'sets the editable text for a page from the site config file' do it 'sets the editable text for a page from the site config file' do
page = @site.pages.where(:title => 'Contact').first page = @site.pages.where(:title => 'Contact').first
page.find_editable_element('content', 'address').content.should == '<p>Our office address: 215 Vine Street, Scranton, PA 18503</p>' page.find_editable_element('content', 'address').content.should match('<p>Our office address: 215 Vine Street, Scranton, PA 18503<br /><img src="/sites/[^/]+/assets/[^/]+/office.jpg" alt="office.jpg" /></p>')
end end
it 'sets the editable file for a page from the site config file' do it 'sets the editable file for a page from the site config file' do