Bugfix: import site with empty editable file.

This commit is contained in:
Andrea Frigido 2011-08-03 08:58:47 +02:00
parent 3966c7bdae
commit 37c50d27ff
3 changed files with 11 additions and 4 deletions

View File

@ -105,10 +105,12 @@ module Locomotive
next if element.nil?
if element.respond_to?(:source)
asset_path = File.join(theme_path, 'public', attributes['content'])
unless attributes['content'].blank?
asset_path = File.join(theme_path, 'public', attributes['content'])
if File.exists?(asset_path)
element.source = File.open(asset_path)
if File.exists?(asset_path)
element.source = File.open(asset_path)
end
end
else
element.content = attributes['content']

Binary file not shown.

View File

@ -73,6 +73,11 @@ describe Locomotive::Import::Job do
page = @site.pages.where(:title => 'Contact').first
page.find_editable_element('content', 'office').source_filename.should == 'office.jpg'
end
it 'sets the empty editable file for a page from the site config file' do
page = @site.pages.where(:title => 'Contact').first
page.find_editable_element('content', 'office2').source_filename.should be_nil
end
it 'inserts templatized page' do
page = @site.pages.where(:templatized => true).first
@ -126,4 +131,4 @@ describe Locomotive::Import::Job do
end
end
end