Commit c9061f8056accb6b3825718f3138fe79ffd5bdee

Authored by AntonioTerceiro
1 parent b1a5f5ed

ActionItem256: removing blocks from search controller


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1691 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/application.rb
... ... @@ -13,13 +13,18 @@ class ApplicationController < ActionController::Base
13 13 def self.no_design_blocks
14 14 @no_design_blocks = true
15 15 end
  16 + def self.uses_design_blocks?
  17 + !@no_design_blocks
  18 + end
  19 + def uses_design_blocks?
  20 + self.class.uses_design_blocks?
  21 + end
16 22 module UsesDesignBlocksHelper
17 23 def uses_design_blocks?
18   - ! self.class.instance_variable_get('@no_design_blocks')
  24 + @controller.uses_design_blocks?
19 25 end
20 26 end
21 27 helper UsesDesignBlocksHelper
22   - include UsesDesignBlocksHelper
23 28  
24 29 # Be sure to include AuthenticationSystem in Application Controller instead
25 30 include AuthenticatedSystem
... ...
app/controllers/public/search_controller.rb
... ... @@ -6,6 +6,8 @@ class SearchController < ApplicationController
6 6 before_filter :prepare_filter
7 7 before_filter :check_search_whole_site
8 8  
  9 + no_design_blocks
  10 +
9 11 protected
10 12  
11 13 def search(finder, query)
... ...
test/functional/search_controller_test.rb
... ... @@ -467,5 +467,10 @@ class SearchControllerTest < Test::Unit::TestCase
467 467 get :assets, :asset => 'products'
468 468 assert_equal 'Products', assigns(:asset_name)
469 469 end
  470 +
  471 + should 'not use design blocks' do
  472 + get :index
  473 + assert_no_tag :tag => 'div', :attributes => { :id => 'boxes', :class => 'boxes' }
  474 + end
470 475  
471 476 end
... ...