Commit c9061f8056accb6b3825718f3138fe79ffd5bdee
1 parent
b1a5f5ed
Exists in
master
and in
28 other branches
ActionItem256: removing blocks from search controller
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1691 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
14 additions
and
2 deletions
Show diff stats
app/controllers/application.rb
@@ -13,13 +13,18 @@ class ApplicationController < ActionController::Base | @@ -13,13 +13,18 @@ class ApplicationController < ActionController::Base | ||
13 | def self.no_design_blocks | 13 | def self.no_design_blocks |
14 | @no_design_blocks = true | 14 | @no_design_blocks = true |
15 | end | 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 | module UsesDesignBlocksHelper | 22 | module UsesDesignBlocksHelper |
17 | def uses_design_blocks? | 23 | def uses_design_blocks? |
18 | - ! self.class.instance_variable_get('@no_design_blocks') | 24 | + @controller.uses_design_blocks? |
19 | end | 25 | end |
20 | end | 26 | end |
21 | helper UsesDesignBlocksHelper | 27 | helper UsesDesignBlocksHelper |
22 | - include UsesDesignBlocksHelper | ||
23 | 28 | ||
24 | # Be sure to include AuthenticationSystem in Application Controller instead | 29 | # Be sure to include AuthenticationSystem in Application Controller instead |
25 | include AuthenticatedSystem | 30 | include AuthenticatedSystem |
app/controllers/public/search_controller.rb
@@ -6,6 +6,8 @@ class SearchController < ApplicationController | @@ -6,6 +6,8 @@ class SearchController < ApplicationController | ||
6 | before_filter :prepare_filter | 6 | before_filter :prepare_filter |
7 | before_filter :check_search_whole_site | 7 | before_filter :check_search_whole_site |
8 | 8 | ||
9 | + no_design_blocks | ||
10 | + | ||
9 | protected | 11 | protected |
10 | 12 | ||
11 | def search(finder, query) | 13 | def search(finder, query) |
test/functional/search_controller_test.rb
@@ -467,5 +467,10 @@ class SearchControllerTest < Test::Unit::TestCase | @@ -467,5 +467,10 @@ class SearchControllerTest < Test::Unit::TestCase | ||
467 | get :assets, :asset => 'products' | 467 | get :assets, :asset => 'products' |
468 | assert_equal 'Products', assigns(:asset_name) | 468 | assert_equal 'Products', assigns(:asset_name) |
469 | end | 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 | end | 476 | end |