Commit dfe9d61b59f9ab1210f94c4c8c0611e560dff4a4
1 parent
1cf42fc1
Exists in
master
and in
23 other branches
Remove unecessary Noosfero::Plugin::Context class
It was just a wrapper around controller, with no clear goal. In the end, the context will the object which invokes the plugins. Rigth now it means basically a controller, but wait a little bit and see. ;-)
Showing
3 changed files
with
2 additions
and
18 deletions
Show diff stats
config/initializers/plugins.rb
| 1 | require 'noosfero/plugin' | 1 | require 'noosfero/plugin' |
| 2 | require 'noosfero/plugin/manager' | 2 | require 'noosfero/plugin/manager' |
| 3 | -require 'noosfero/plugin/context' | ||
| 4 | require 'noosfero/plugin/active_record' | 3 | require 'noosfero/plugin/active_record' |
| 5 | require 'noosfero/plugin/mailer_base' | 4 | require 'noosfero/plugin/mailer_base' |
| 6 | Noosfero::Plugin.init_system if $NOOSFERO_LOAD_PLUGINS | 5 | Noosfero::Plugin.init_system if $NOOSFERO_LOAD_PLUGINS |
lib/noosfero/plugin/context.rb
| @@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
| 1 | -# This class defines the interface to important context information from the | ||
| 2 | -# controller that can be accessed by plugins | ||
| 3 | -class Noosfero::Plugin::Context | ||
| 4 | - | ||
| 5 | - def initialize(controller) | ||
| 6 | - @controller = controller | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - delegate :profile, :request, :response, :environment, :params, :session, :user, :logged_in?, :to => :controller | ||
| 10 | - | ||
| 11 | - protected | ||
| 12 | - | ||
| 13 | - attr_reader :controller | ||
| 14 | - | ||
| 15 | -end |
lib/noosfero/plugin/manager.rb
| @@ -3,9 +3,9 @@ class Noosfero::Plugin::Manager | @@ -3,9 +3,9 @@ class Noosfero::Plugin::Manager | ||
| 3 | attr_reader :environment | 3 | attr_reader :environment |
| 4 | attr_reader :context | 4 | attr_reader :context |
| 5 | 5 | ||
| 6 | - def initialize(environment, controller) | 6 | + def initialize(environment, context) |
| 7 | @environment = environment | 7 | @environment = environment |
| 8 | - @context = Noosfero::Plugin::Context.new(controller) | 8 | + @constantize = context |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | delegate :each, :to => :enabled_plugins | 11 | delegate :each, :to => :enabled_plugins |