[Git][noosfero/noosfero][master] 2 commits: bug fix - display content block is not showing article image when option is checked
Bráulio Bhavamitra
gitlab at mg.gitlab.com
Tue Jun 7 13:24:42 BRT 2016
Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero
Commits:
f6be1e95 by Melissa Wen at 2016-06-05T19:57:45-04:00
bug fix - display content block is not showing article image when option is checked
- - - - -
eb631713 by Bráulio Bhavamitra at 2016-06-07T16:24:26+00:00
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
- - - - -
2 changed files:
- plugins/display_content/test/unit/display_content_block_test.rb
- plugins/display_content/views/blocks/display_content/_section.slim
Changes:
=====================================
plugins/display_content/test/unit/display_content_block_test.rb
=====================================
--- 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
=====================================
plugins/display_content/views/blocks/display_content/_section.slim
=====================================
--- 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'
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/733814ea4658e164cb6e46ae7d28e583ccea43b3...eb631713a254469a1979bc08344eba6cb1228115
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160607/20a56aa5/attachment-0001.html>
More information about the Noosfero-dev
mailing list