summaryrefslogtreecommitdiff
path: root/lib/commands/dashboard/index_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/commands/dashboard/index_command.rb')
-rw-r--r--lib/commands/dashboard/index_command.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/commands/dashboard/index_command.rb b/lib/commands/dashboard/index_command.rb
index dbc48fb..92d8342 100644
--- a/lib/commands/dashboard/index_command.rb
+++ b/lib/commands/dashboard/index_command.rb
@@ -6,13 +6,23 @@ module Booty
class IndexCommand < Booty::RouteCommand
handles :uri => /^\/$/, :verb => :GET
- def initialize(view_engine)
+ def initialize(view_engine, users_repository)
@view_engine = view_engine
+ @users = users_repository
end
def respond_to(request)
- p request.cookies
- HtmlResponse.new(:template => "/dashboard/index")
+ HtmlResponse.new(:template => "/dashboard/index", :model => lookup_user_from(request))
+ end
+
+ private
+
+ def lookup_user_from(request)
+ if request.cookies.has_key?(Cookies::SESSION)
+ @users.find_by(request.cookies[Cookies::SESSION])
+ else
+ OpenStruct.new(:username => 'world')
+ end
end
end
end