Commit 5bc5378063ae98be529a86716f7232cda6ebfabc
1 parent
90af7f05
Exists in
master
and in
28 other branches
ActionItem114: reorganizing class
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@835 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
20 additions
and
19 deletions
Show diff stats
app/controllers/application.rb
... | ... | @@ -15,7 +15,26 @@ class ApplicationController < ActionController::Base |
15 | 15 | before_filter :detect_stuff_by_domain |
16 | 16 | attr_reader :environment |
17 | 17 | |
18 | - protected | |
18 | + def self.needs_profile | |
19 | + before_filter :load_profile | |
20 | + design :holder => 'profile' | |
21 | + end | |
22 | + | |
23 | + def self.acts_as_environment_admin_controller | |
24 | + before_filter :load_admin_controller | |
25 | + end | |
26 | + | |
27 | + # declares that the given <tt>actions</tt> cannot be accessed by other HTTP | |
28 | + # method besides POST. | |
29 | + def self.post_only(actions, redirect = { :action => 'index'}) | |
30 | + verify :method => :post, :only => actions, :redirect_to => redirect | |
31 | + end | |
32 | + | |
33 | + protected | |
34 | + | |
35 | + def profile | |
36 | + @profile | |
37 | + end | |
19 | 38 | |
20 | 39 | # TODO: move this logic somewhere else (Domain class?) |
21 | 40 | def detect_stuff_by_domain |
... | ... | @@ -28,18 +47,8 @@ class ApplicationController < ActionController::Base |
28 | 47 | end |
29 | 48 | end |
30 | 49 | |
31 | - def profile | |
32 | - @profile | |
33 | - end | |
34 | - | |
35 | - def self.needs_profile | |
36 | - before_filter :load_profile | |
37 | - design :holder => 'profile' | |
38 | - end | |
39 | - | |
40 | 50 | def load_profile |
41 | 51 | @profile ||= Profile.find_by_identifier(params[:profile]) |
42 | -# @profile ||= Profile.find(:first) | |
43 | 52 | render_not_found(request.path) unless profile |
44 | 53 | end |
45 | 54 | |
... | ... | @@ -48,16 +57,8 @@ class ApplicationController < ActionController::Base |
48 | 57 | render :file => File.join(RAILS_ROOT, 'app', 'views', 'shared', 'not_found.rhtml'), :layout => 'not_found', :status => 404 |
49 | 58 | end |
50 | 59 | |
51 | - def self.acts_as_environment_admin_controller | |
52 | - before_filter :load_admin_controller | |
53 | - end | |
54 | 60 | def load_admin_controller |
55 | 61 | # TODO: check access control |
56 | 62 | end |
57 | 63 | |
58 | - # declares that the given <tt>actions</tt> cannot be accessed by other HTTP | |
59 | - # method besides POST. | |
60 | - def self.post_only(actions, redirect = { :action => 'index'}) | |
61 | - verify :method => :post, :only => actions, :redirect_to => redirect | |
62 | - end | |
63 | 64 | end | ... | ... |