diff --git a/plugins/display_content/test/unit/display_content_block_test.rb b/plugins/display_content/test/unit/display_content_block_test.rb index d78482a..4a73a96 100644 --- a/plugins/display_content/test/unit/display_content_block_test.rb +++ b/plugins/display_content/test/unit/display_content_block_test.rb @@ -656,6 +656,23 @@ class DisplayContentBlockViewTest < ActionView::TestCase assert_match /#{a.published_at}/, render_block_content(block) end + should 'show image if defined by user' do + profile = create_user('testuser').person + a = create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) + a.save! + + process_delayed_job_queue + + block = DisplayContentBlock.new + block.nodes = [a.id] + block.sections = [{:value => 'image', :checked => true}] + box = mock() + block.stubs(:box).returns(box) + box.stubs(:owner).returns(profile) + + assert_tag_in_string render_block_content(block), :tag => 'div', :attributes => {:class => 'image'} + end + should 'show articles in recent order' do profile = create_user('testuser').person Article.delete_all diff --git a/plugins/display_content/views/blocks/display_content/_section.slim b/plugins/display_content/views/blocks/display_content/_section.slim index a2bad45..5958f73 100644 --- a/plugins/display_content/views/blocks/display_content/_section.slim +++ b/plugins/display_content/views/blocks/display_content/_section.slim @@ -13,7 +13,7 @@ div class='body' = (item.body || '').html_safe - when 'image' - - unless item.image || item.image.public_filename + - if item.image && item.image.public_filename div class='image' = link_to(image_tag(item.image.public_filename), item.url) - when 'tags' -- libgit2 0.21.2