Commit 5124f3d750b09b85323fff0140ae4f7a2ce5757b

Authored by MoisesMachado
1 parent 2196d7c4

ActionItem6: oops, forgot to save the file with the changes

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@210 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 9 additions and 2 deletions   Show diff stats
app/controllers/enterprise_controller.rb
1 # Manage enterprises by providing an interface to register, activate and manage them 1 # Manage enterprises by providing an interface to register, activate and manage them
2 class EnterpriseController < ApplicationController 2 class EnterpriseController < ApplicationController
3 3
4 - before_filter :logon 4 + before_filter :logon, :my_enterprises
5 5
6 def index 6 def index
7 - @my_enterprises = current_user.person.my_enterprises  
8 @enterprises = Enterprise.find(:all) - @my_enterprises 7 @enterprises = Enterprise.find(:all) - @my_enterprises
9 end 8 end
10 9
@@ -25,9 +24,17 @@ class EnterpriseController &lt; ApplicationController @@ -25,9 +24,17 @@ class EnterpriseController &lt; ApplicationController
25 end 24 end
26 end 25 end
27 26
  27 + def show
  28 + @enterprise = @my_enterprises.find{|e| e.id == params[:id]}
  29 + end
  30 +
28 protected 31 protected
29 32
30 def logon 33 def logon
31 redirect_to :controller => 'account' unless logged_in? 34 redirect_to :controller => 'account' unless logged_in?
32 end 35 end
  36 +
  37 + def my_enterprises
  38 + @my_enterprises = current_user.person.my_enterprises
  39 + end
33 end 40 end