Commit dc75141d944c94ef138f0be6415b46814b2829e1
1 parent
54ddb689
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
put the correct path for block preview
Showing
2 changed files
with
3 additions
and
6 deletions
Show diff stats
app/helpers/box_organizer_helper.rb
@@ -28,9 +28,6 @@ module BoxOrganizerHelper | @@ -28,9 +28,6 @@ module BoxOrganizerHelper | ||
28 | 28 | ||
29 | theme = Theme.new(environment.theme) # remove this | 29 | theme = Theme.new(environment.theme) # remove this |
30 | 30 | ||
31 | -# images_path = Dir.glob(File.join(theme.public_path, 'images', block.previews_path, '*')) | ||
32 | - | ||
33 | - | ||
34 | images_path = Dir.glob(File.join(theme.filesystem_path, 'images', block.preview_path, '*')) | 31 | images_path = Dir.glob(File.join(theme.filesystem_path, 'images', block.preview_path, '*')) |
35 | images_path = images_path.map{|path| path.gsub(theme.filesystem_path, theme.public_path) } unless images_path.empty? | 32 | images_path = images_path.map{|path| path.gsub(theme.filesystem_path, theme.public_path) } unless images_path.empty? |
36 | 33 | ||
@@ -38,7 +35,7 @@ module BoxOrganizerHelper | @@ -38,7 +35,7 @@ module BoxOrganizerHelper | ||
38 | images_path = images_path.map{|path| path.gsub(File.join(Rails.root, 'public'), '') } unless images_path.empty? | 35 | images_path = images_path.map{|path| path.gsub(File.join(Rails.root, 'public'), '') } unless images_path.empty? |
39 | 36 | ||
40 | images_path = Dir.glob(File.join(Rails.root, 'public', 'images', block.preview_path, '*')) if images_path.empty? | 37 | images_path = Dir.glob(File.join(Rails.root, 'public', 'images', block.preview_path, '*')) if images_path.empty? |
41 | - images_path = images_path.map{|path| path.gsub(File.join(Rails.root, 'public', 'images'), '') } unless images_path.empty? | 38 | + images_path = images_path.map{|path| path.gsub(File.join(Rails.root, 'public'), '') } unless images_path.empty? |
42 | 39 | ||
43 | images_path = 1.upto(3).map{block.default_preview_path} if images_path.empty? | 40 | images_path = 1.upto(3).map{block.default_preview_path} if images_path.empty? |
44 | 41 |
test/unit/box_organizer_helper_test.rb
@@ -158,8 +158,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase | @@ -158,8 +158,8 @@ class BoxOrganizerHelperTest < ActionView::TestCase | ||
158 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) | 158 | Dir.stubs(:glob).with(File.join(base_path, '*')).returns([File.join(base_path, 'p1.png'), File.join(base_path, 'p2.png')]) |
159 | doc = HTML::Document.new display_previews(block) | 159 | doc = HTML::Document.new display_previews(block) |
160 | assert_select doc.root, 'li' do |elements| | 160 | assert_select doc.root, 'li' do |elements| |
161 | - assert_match /img.* src="\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s | ||
162 | - assert_match /img.* src="\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s | 161 | + assert_match /img.* src="\/images\/blocks\/some_block\/previews\/p1.png"/, elements[0].to_s |
162 | + assert_match /img.* src="\/images\/blocks\/some_block\/previews\/p2.png"/, elements[1].to_s | ||
163 | end | 163 | end |
164 | end | 164 | end |
165 | 165 |