Commit 8f6d44eab6185ed80f714f08e452510ec94a0dc8

Authored by Rodrigo Souto
2 parents 81971fd5 1ffd3768

Merge branch 'refactor_container_block_plugin_html_generation' into 'master'

Remove HTML generation from container_block plugin

It now uses BoxesHelper logic instead of HTML generation within the
model violating MVC.

As it is a class within a module
(`ContainerBlockPlugin::ContainerBlock`) `BoxesHelper` required fixes to
handle the module prefix when searching for the proper view to render.
Previously it would wrongly search for
`blocks/container_block_plugin/container.html.erb` instead of
`blocks/container.html.erb`.

In case gitlab build does not start, here is the Travis build: https://travis-ci.org/rafamanzo/noosfero/builds/118607978

See merge request !827
app/helpers/boxes_helper.rb
... ... @@ -88,7 +88,7 @@ module BoxesHelper
88 88 end
89 89  
90 90 def render_block block, prefix = nil, klass = block.class
91   - template_name = klass.name.underscore.sub '_block', ''
  91 + template_name = klass.name.demodulize.underscore.sub '_block', ''
92 92 begin
93 93 render template: "blocks/#{prefix}#{template_name}", locals: { block: block }
94 94 rescue ActionView::MissingTemplate
... ...
plugins/container_block/lib/container_block_plugin/container_block.rb
... ... @@ -66,13 +66,6 @@ class ContainerBlockPlugin::ContainerBlock < Block
66 66 children_settings[child_id][:width] if children_settings[child_id]
67 67 end
68 68  
69   - def content(args={})
70   - block = self
71   - proc do
72   - render :file => 'blocks/container', :locals => {:block => block}
73   - end
74   - end
75   -
76 69 def copy_from_with_container(block)
77 70 copy_from_without_container(block)
78 71 children_settings = block.children_settings
... ...