Commit 8f6d44eab6185ed80f714f08e452510ec94a0dc8
Exists in
web_steps_improvements
and in
8 other branches
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
Showing
2 changed files
with
1 additions
and
8 deletions
Show diff stats
app/helpers/boxes_helper.rb
@@ -88,7 +88,7 @@ module BoxesHelper | @@ -88,7 +88,7 @@ module BoxesHelper | ||
88 | end | 88 | end |
89 | 89 | ||
90 | def render_block block, prefix = nil, klass = block.class | 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 | begin | 92 | begin |
93 | render template: "blocks/#{prefix}#{template_name}", locals: { block: block } | 93 | render template: "blocks/#{prefix}#{template_name}", locals: { block: block } |
94 | rescue ActionView::MissingTemplate | 94 | rescue ActionView::MissingTemplate |
plugins/container_block/lib/container_block_plugin/container_block.rb
@@ -66,13 +66,6 @@ class ContainerBlockPlugin::ContainerBlock < Block | @@ -66,13 +66,6 @@ class ContainerBlockPlugin::ContainerBlock < Block | ||
66 | children_settings[child_id][:width] if children_settings[child_id] | 66 | children_settings[child_id][:width] if children_settings[child_id] |
67 | end | 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 | def copy_from_with_container(block) | 69 | def copy_from_with_container(block) |
77 | copy_from_without_container(block) | 70 | copy_from_without_container(block) |
78 | children_settings = block.children_settings | 71 | children_settings = block.children_settings |