Commit 5122d529c6421d958d5a88bb9a4ec8c04a98afca

Authored by Rafael Reggiani Manzo
Committed by Joenio Costa
1 parent 62f89772

Fix plugin compatibility with HTML decoupling

The core has been refactored in order to remove HTML generation from
models. On the other hand there are many plugins relying on such
behaviour.

This provides a failsafe in order to keep them working until the
necessary refactors for each plugin do not get done.
Showing 1 changed file with 13 additions and 2 deletions   Show diff stats
app/helpers/boxes_helper.rb
... ... @@ -108,9 +108,20 @@ module BoxesHelper
108 108 end
109 109  
110 110 def display_block_content(block, main_content = nil)
111   - content = block.main? ? wrap_main_content(main_content) : render_block_content(block)
  111 + # FIXME: these conditionals should be removed after all block footer from plugins methods get refactored into helpers and views. They are a failsafe until all of them are done.
  112 + content = nil
  113 + if block.main?
  114 + content = wrap_main_content(main_content)
  115 + else
  116 + if(block.method(:content).owner != Block)
  117 + content = block.content()
  118 + else
  119 + content = render_block_content(block)
  120 + end
  121 + end
112 122 result = extract_block_content(content)
113   - footer_content = extract_block_content(render_block_footer(block))
  123 + # FIXME: this ternary conditional should be removed after all block footer from plugins methods get refactored into helpers and views
  124 + footer_content = extract_block_content(block.method(:footer).owner != Block ? block.footer : render_block_footer(block))
114 125 unless footer_content.blank?
115 126 footer_content = content_tag('div', footer_content, :class => 'block-footer-content' )
116 127 end
... ...