Commit f6aa1bcadc28285a3ae0c7c6d1182c05c8b6c10e

Authored by AntonioTerceiro
1 parent e40a294a

r250@sede: terceiro | 2007-07-29 19:25:52 -0300

ActionItem0: moving controller methods to their own file


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@254 3f533792-8f58-4932-b0fe-aaf55b0a4547
vendor/plugins/design/init.rb
1 1 require 'design'
2 2 require 'acts_as_design'
3 3  
4   -class ActionController::Base
5   -
6   - # Declares that this controller uses design plugin to generate its layout.
7   - # See the plugin README for options that can be passed to this method.
8   - def self.design(config = {})
9   -
10   - raise ArgumentError.new("design argument must be a Hash") unless config.kind_of? Hash
11   -
12   - if (config.has_key?(:holder) && config.has_key?(:fixed)) || (!config.has_key?(:holder) && !config.has_key?(:fixed))
13   - raise ArgumentError.new("You must supply either <tt>:holder</tt> or <tt>:fixed</tt> to design.")
14   - end
15   -
16   - @design_plugin_config = config
17   -
18   - def self.design_plugin_config
19   - @design_plugin_config || self.superclass.design_plugin_config
20   - end
21   -
22   - include Design
23   - helper Design::Helper
24   - end
25   -
26   - # declares this controller as a design editor, including in it all the
27   - # functionalities to do that (besides those for using a design). Accepts the
28   - # same options as design.
29   - def self.design_editor(config = {})
30   - self.design(config)
31   - include Design::Editor
32   - helper Design::Editor::Helper
33   - end
34   -
35   -end
36   -
... ...
vendor/plugins/design/lib/design.rb
  1 +require 'design/controller_methods'
  2 +
1 3 require 'design/fixed_design_holder'
2 4 require 'design/proxy_design_holder'
3 5  
... ...
vendor/plugins/design/lib/design/controller_methods.rb 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +class ActionController::Base
  2 +
  3 + # Declares that this controller uses design plugin to generate its layout.
  4 + # See the plugin README for options that can be passed to this method.
  5 + def self.design(config = {})
  6 +
  7 + raise ArgumentError.new("design argument must be a Hash") unless config.kind_of? Hash
  8 +
  9 + if (config.has_key?(:holder) && config.has_key?(:fixed)) || (!config.has_key?(:holder) && !config.has_key?(:fixed))
  10 + raise ArgumentError.new("You must supply either <tt>:holder</tt> or <tt>:fixed</tt> to design.")
  11 + end
  12 +
  13 + @design_plugin_config = config
  14 +
  15 + def self.design_plugin_config
  16 + @design_plugin_config || self.superclass.design_plugin_config
  17 + end
  18 +
  19 + include Design
  20 + helper Design::Helper
  21 + end
  22 +
  23 + # declares this controller as a design editor, including in it all the
  24 + # functionalities to do that (besides those for using a design). Accepts the
  25 + # same options as design.
  26 + def self.design_editor(config = {})
  27 + self.design(config)
  28 + include Design::Editor
  29 + helper Design::Editor::Helper
  30 + end
  31 +
  32 +end
  33 +
... ...