Commit ae596476d02ce90fc3f1100278ff31d4f3fff21e

Authored by Rafael Reggiani Manzo
1 parent af0cec44

Refactor ProductsBlock footer into helper/view

app/helpers/boxes_helper.rb
... ... @@ -110,7 +110,7 @@ module BoxesHelper
110 110 def display_block_content(block, main_content = nil)
111 111 content = block.main? ? wrap_main_content(main_content) : render_block_content(block)
112 112 result = extract_block_content(content)
113   - footer_content = extract_block_content(block.respond_to?(:footer) ? block.footer : render_block_footer(block)) # FIXME: this ternary conditional should be removed after all block footer methods get refatored into helpers and views
  113 + footer_content = extract_block_content(render_block_footer(block))
114 114 unless footer_content.blank?
115 115 footer_content = content_tag('div', footer_content, :class => 'block-footer-content' )
116 116 end
... ...
app/models/tags_block.rb
... ... @@ -28,21 +28,6 @@ class TagsBlock < Block
28 28 Try to add some tags to some articles and you'l see your tag cloud growing.")
29 29 end
30 30  
31   - def footer
32   - if owner.class == Environment
33   - proc do
34   - link_to s_('tags|View all'),
35   - :controller => 'search', :action => 'tags'
36   - end
37   - else
38   - owner_id = owner.identifier
39   - proc do
40   - link_to s_('tags|View all'),
41   - :profile => owner_id, :controller => 'profile', :action => 'tags'
42   - end
43   - end
44   - end
45   -
46 31 def timeout
47 32 15.minutes
48 33 end
... ...
app/views/blocks/footers/tags.html.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<% if block.owner.is_a?(Environment) %>
  2 + <%= link_to s_('tags|View all'), :controller => 'search', :action => 'tags' %>
  3 +<% else %>
  4 + <%= link_to s_('tags|View all'), :profile => block.owner.identifier, :controller => 'profile', :action => 'tags' %>
  5 +<% end %>
... ...