Commit eb631713a254469a1979bc08344eba6cb1228115
Exists in
profile_api_improvements
and in
1 other branch
Merge branch 'fix_display_content_with_image_option_checked' into 'master'
bug fix - display content block is not showing article image when option is checked See merge request !954
Showing
2 changed files
with
18 additions
and
1 deletions
Show diff stats
plugins/display_content/test/unit/display_content_block_test.rb
@@ -656,6 +656,23 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -656,6 +656,23 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
656 | assert_match /#{a.published_at}/, render_block_content(block) | 656 | assert_match /#{a.published_at}/, render_block_content(block) |
657 | end | 657 | end |
658 | 658 | ||
659 | + should 'show image if defined by user' do | ||
660 | + profile = create_user('testuser').person | ||
661 | + a = create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) | ||
662 | + a.save! | ||
663 | + | ||
664 | + process_delayed_job_queue | ||
665 | + | ||
666 | + block = DisplayContentBlock.new | ||
667 | + block.nodes = [a.id] | ||
668 | + block.sections = [{:value => 'image', :checked => true}] | ||
669 | + box = mock() | ||
670 | + block.stubs(:box).returns(box) | ||
671 | + box.stubs(:owner).returns(profile) | ||
672 | + | ||
673 | + assert_tag_in_string render_block_content(block), :tag => 'div', :attributes => {:class => 'image'} | ||
674 | + end | ||
675 | + | ||
659 | should 'show articles in recent order' do | 676 | should 'show articles in recent order' do |
660 | profile = create_user('testuser').person | 677 | profile = create_user('testuser').person |
661 | Article.delete_all | 678 | Article.delete_all |
plugins/display_content/views/blocks/display_content/_section.slim
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | div class='body' | 13 | div class='body' |
14 | = (item.body || '').html_safe | 14 | = (item.body || '').html_safe |
15 | - when 'image' | 15 | - when 'image' |
16 | - - unless item.image || item.image.public_filename | 16 | + - if item.image && item.image.public_filename |
17 | div class='image' | 17 | div class='image' |
18 | = link_to(image_tag(item.image.public_filename), item.url) | 18 | = link_to(image_tag(item.image.public_filename), item.url) |
19 | - when 'tags' | 19 | - when 'tags' |