Commit 073f57b540beb039e79d76bf665cac75f1534604
1 parent
da26a752
Exists in
staging
and in
42 other branches
Recovering most recent code for ApplicationController
Showing
1 changed file
with
15 additions
and
5 deletions
Show diff stats
app/controllers/application_controller.rb
| ... | ... | @@ -83,6 +83,7 @@ class ApplicationController < ActionController::Base |
| 83 | 83 | include NeedsProfile |
| 84 | 84 | |
| 85 | 85 | before_filter :detect_stuff_by_domain |
| 86 | + before_filter :init_noosfero_plugins | |
| 86 | 87 | attr_reader :environment |
| 87 | 88 | |
| 88 | 89 | before_filter :load_terminology |
| ... | ... | @@ -93,8 +94,16 @@ class ApplicationController < ActionController::Base |
| 93 | 94 | verify :method => :post, :only => actions, :redirect_to => redirect |
| 94 | 95 | end |
| 95 | 96 | |
| 97 | + helper_method :current_person, :current_person | |
| 98 | + | |
| 96 | 99 | protected |
| 97 | 100 | |
| 101 | + def user | |
| 102 | + current_user.person if logged_in? | |
| 103 | + end | |
| 104 | + | |
| 105 | + alias :current_person :user | |
| 106 | + | |
| 98 | 107 | # TODO: move this logic somewhere else (Domain class?) |
| 99 | 108 | def detect_stuff_by_domain |
| 100 | 109 | @domain = Domain.find_by_name(request.host) |
| ... | ... | @@ -106,6 +115,10 @@ class ApplicationController < ActionController::Base |
| 106 | 115 | end |
| 107 | 116 | end |
| 108 | 117 | |
| 118 | + def init_noosfero_plugins | |
| 119 | + @plugins = Noosfero::Plugin::Manager.new(self) | |
| 120 | + end | |
| 121 | + | |
| 109 | 122 | def load_terminology |
| 110 | 123 | # cache terminology for performance |
| 111 | 124 | @@terminology_cache ||= {} |
| ... | ... | @@ -116,8 +129,9 @@ class ApplicationController < ActionController::Base |
| 116 | 129 | def render_not_found(path = nil) |
| 117 | 130 | @no_design_blocks = true |
| 118 | 131 | @path ||= request.path |
| 119 | - render :template => 'shared/not_found.rhtml', :status => 404 | |
| 132 | + render :template => 'shared/not_found.rhtml', :status => 404, :layout => get_layout | |
| 120 | 133 | end |
| 134 | + alias :render_404 :render_not_found | |
| 121 | 135 | |
| 122 | 136 | def render_access_denied(message = nil, title = nil) |
| 123 | 137 | @no_design_blocks = true |
| ... | ... | @@ -126,10 +140,6 @@ class ApplicationController < ActionController::Base |
| 126 | 140 | render :template => 'shared/access_denied.rhtml', :status => 403 |
| 127 | 141 | end |
| 128 | 142 | |
| 129 | - def user | |
| 130 | - current_user.person if logged_in? | |
| 131 | - end | |
| 132 | - | |
| 133 | 143 | def load_category |
| 134 | 144 | unless params[:category_path].blank? |
| 135 | 145 | path = params[:category_path].join('/') | ... | ... |