Skip to content

Commit

Permalink
Merge pull request locomotivecms#152 from frisoft/master
Browse files Browse the repository at this point in the history
Bugfix: import and italian localization update.
  • Loading branch information
did committed Aug 11, 2011
2 parents 67d7b13 + 37c50d2 commit 7a4253a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions config/locales/admin_ui.it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions lib/locomotive/import/pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ def assign_editable_elements(page, elements)
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']
Expand Down
Binary file modified spec/fixtures/themes/default.zip
Binary file not shown.
7 changes: 6 additions & 1 deletion spec/lib/locomotive/import_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
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
Expand Down Expand Up @@ -126,4 +131,4 @@
end


end
end

0 comments on commit 7a4253a

Please sign in to comment.