diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index 2960a75..953b55f 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -7,6 +7,17 @@ class ApplicationController < ActionController::Base
design :holder => 'environment'
+ def self.no_design_blocks
+ @no_design_blocks = true
+ end
+ module UsesDesignBlocksHelper
+ def uses_design_blocks?
+ ! self.class.instance_variable_get('@no_design_blocks')
+ end
+ end
+ helper UsesDesignBlocksHelper
+ include UsesDesignBlocksHelper
+
# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem
include PermissionCheck
diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml
index 40793d6..f0bd574 100644
--- a/app/views/layouts/application.rhtml
+++ b/app/views/layouts/application.rhtml
@@ -21,9 +21,6 @@
<% if params[:controller] == 'cms' %>
<%= javascript_include_tag 'cms' %>
<% end %>
-
- <%# FIXME this is temporary for tests %>
- <%= stylesheet_link_tag 'composer' %>
@@ -80,11 +77,10 @@
- <%# FIXME this is temporary %>
- <% if params[:controller] == 'composer' %>
- <%= yield %>
- <% else %>
+ <% if uses_design_blocks? %>
<%= design_display(yield) %>
+ <% else %>
+ <%= yield %>
<% end %>
diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb
index 7d7c31d..033d3f5 100644
--- a/test/functional/application_controller_test.rb
+++ b/test/functional/application_controller_test.rb
@@ -92,4 +92,30 @@ class ApplicationControllerTest < Test::Unit::TestCase
:attributes => { :class => 'help_box'},
})
end
+
+ should 'be able to not use design blocks' do
+
+ class UsesBlocksTestController < ApplicationController
+ end
+ assert UsesBlocksTestController.new.uses_design_blocks?
+
+ class DoesNotUsesBlocksTestController < ApplicationController
+ no_design_blocks
+ end
+ assert !DoesNotUsesBlocksTestController.new.uses_design_blocks?
+ end
+
+ should 'use design plugin to generate blocks' do
+ get :index
+ assert_tag :tag => 'div', :attributes => { :id => 'boxes', :class => 'design_boxes' }
+ end
+
+ should 'not use design plugin when tells so' do
+ class NoDesignBlocksTestController < ApplicationController
+ no_design_blocks
+ end
+ @controller = NoDesignBlocksTestController.new
+ get :index
+ assert_no_tag :tag => 'div', :attributes => { :id => 'boxes', :class => 'design_boxes' }
+ end
end
diff --git a/test/mocks/test/test_controller.rb b/test/mocks/test/test_controller.rb
index 09e3e3b..d83dbfb 100644
--- a/test/mocks/test/test_controller.rb
+++ b/test/mocks/test/test_controller.rb
@@ -1,7 +1,7 @@
class TestController < ApplicationController
def index
- render :text => 'index'
+ render :text => 'index', :layout => true
end
post_only 'post_only'
--
libgit2 0.21.2