From 073f57b540beb039e79d76bf665cac75f1534604 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Tue, 22 Feb 2011 17:35:33 -0300 Subject: [PATCH] Recovering most recent code for ApplicationController --- app/controllers/application_controller.rb | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7f147a8..cd10b5a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -83,6 +83,7 @@ class ApplicationController < ActionController::Base include NeedsProfile before_filter :detect_stuff_by_domain + before_filter :init_noosfero_plugins attr_reader :environment before_filter :load_terminology @@ -93,8 +94,16 @@ class ApplicationController < ActionController::Base verify :method => :post, :only => actions, :redirect_to => redirect end + helper_method :current_person, :current_person + protected + def user + current_user.person if logged_in? + end + + alias :current_person :user + # TODO: move this logic somewhere else (Domain class?) def detect_stuff_by_domain @domain = Domain.find_by_name(request.host) @@ -106,6 +115,10 @@ class ApplicationController < ActionController::Base end end + def init_noosfero_plugins + @plugins = Noosfero::Plugin::Manager.new(self) + end + def load_terminology # cache terminology for performance @@terminology_cache ||= {} @@ -116,8 +129,9 @@ class ApplicationController < ActionController::Base def render_not_found(path = nil) @no_design_blocks = true @path ||= request.path - render :template => 'shared/not_found.rhtml', :status => 404 + render :template => 'shared/not_found.rhtml', :status => 404, :layout => get_layout end + alias :render_404 :render_not_found def render_access_denied(message = nil, title = nil) @no_design_blocks = true @@ -126,10 +140,6 @@ class ApplicationController < ActionController::Base render :template => 'shared/access_denied.rhtml', :status => 403 end - def user - current_user.person if logged_in? - end - def load_category unless params[:category_path].blank? path = params[:category_path].join('/') -- libgit2 0.21.2