diff --git a/config/locales/admin_ui.it.yml b/config/locales/admin_ui.it.yml index 0b777f5d..fd918e51 100644 --- a/config/locales/admin_ui.it.yml +++ b/config/locales/admin_ui.it.yml @@ -16,6 +16,7 @@ it: welcome: Benvenuto, %{name} see: Vedi il sito web switch: Passa ad un altro sito + help: Aiuto logout: Esci menu: contents: Contenuti diff --git a/lib/locomotive/import/pages.rb b/lib/locomotive/import/pages.rb index f24d098d..5280d11d 100644 --- a/lib/locomotive/import/pages.rb +++ b/lib/locomotive/import/pages.rb @@ -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'] diff --git a/spec/fixtures/themes/default.zip b/spec/fixtures/themes/default.zip index 39e424fd..0ccca2bf 100644 Binary files a/spec/fixtures/themes/default.zip and b/spec/fixtures/themes/default.zip differ diff --git a/spec/lib/locomotive/import_spec.rb b/spec/lib/locomotive/import_spec.rb index ed70cd36..325409af 100644 --- a/spec/lib/locomotive/import_spec.rb +++ b/spec/lib/locomotive/import_spec.rb @@ -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 \ No newline at end of file +end