Commit e40a294a65c9e58f19eeb619f29b06189bb6f7e2
1 parent
e5065105
Exists in
master
and in
22 other branches
r249@sede: terceiro | 2007-07-29 19:24:09 -0300
ActionItem0: adding support for design inheritance git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@253 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
16 additions
and
3 deletions
Show diff stats
vendor/plugins/design/README
... | ... | @@ -48,6 +48,12 @@ The argument do +design_display_boxes()+ is the content you want to be the main |
48 | 48 | content. Almost always you'll want to pass +yield+ (the resulting content for |
49 | 49 | the current action) there, but you can pass anything you want. |
50 | 50 | |
51 | +== Controller subclassing and design | |
52 | + | |
53 | +Designs are inherited through the inheritance tree. This way you can for | |
54 | +example declare the use of a design in ApplicationController and let the other | |
55 | +controllers abstract that fact that they are using design. | |
56 | + | |
51 | 57 | == Storing design information in ActiveRecord models: +acts_as_design+ |
52 | 58 | |
53 | 59 | You can also use ActiveRecord objects | ... | ... |
vendor/plugins/design/init.rb
vendor/plugins/design/test/design_test.rb
... | ... | @@ -52,8 +52,11 @@ class DesignTest < Test::Unit::TestCase |
52 | 52 | |
53 | 53 | def test_subclass_controller_can_override_superclass_design_holder |
54 | 54 | assert_equal 'sample_object', ProxyDesignHolderTestController.send(:design_plugin_config)[:holder] |
55 | - assert_equal 'another_object', InheritanceDesignTestController.send(:design_plugin_config)[:holder] | |
55 | + assert_equal 'another_object', InheritanceWithOverrideDesignTestController.send(:design_plugin_config)[:holder] | |
56 | + end | |
56 | 57 | |
58 | + def test_subclass_should_inherit_supeclass_design | |
59 | + assert_equal 'sample_object', InheritanceDesignTestController.send(:design_plugin_config)[:holder] | |
57 | 60 | end |
58 | 61 | |
59 | 62 | end | ... | ... |
vendor/plugins/design/test/test_helper.rb
... | ... | @@ -60,10 +60,14 @@ class AnotherTestDesignHolder |
60 | 60 | attr_accessor :template, :theme, :icon_theme, :boxes |
61 | 61 | end |
62 | 62 | |
63 | -class InheritanceDesignTestController < ProxyDesignHolderTestController | |
63 | +class InheritanceWithOverrideDesignTestController < ProxyDesignHolderTestController | |
64 | 64 | design :holder => 'another_object' |
65 | 65 | end |
66 | 66 | |
67 | +class InheritanceDesignTestController < ProxyDesignHolderTestController | |
68 | + # nothing | |
69 | +end | |
70 | + | |
67 | 71 | class DesignEditorTestController < ActionController::Base |
68 | 72 | design_editor :holder => 'sample_object' |
69 | 73 | def initialize | ... | ... |