diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 83445dbdefa272abd7d105b064042a7d3e101dd6..d1bc8a521a2a19f629b80f81dd9ab7aa4da7b88d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,10 @@ class ApplicationController < ActionController::Base protect_from_forgery :except => :receive layout 'application' - + before_filter :set_friends + + def set_friends + @friends = Friend.all + end + end diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 0c24a76bd3d11578b7da88ffd92e69e7b4d4a07e..00b1b8e1a379727c35cd3cdfb56c63b13be42810 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -2,7 +2,6 @@ class StatusMessagesController < ApplicationController before_filter :authenticate_user! def index - @status_message = StatusMessage.new @status_messages = StatusMessage.sort(:created_at.desc).all diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml index 3a892c6510c22474bf9db184bb49dbcd6cb7ea93..8d669a018c494391173a398fdcae0a033ed65669 100644 --- a/app/views/dashboard/index.html.haml +++ b/app/views/dashboard/index.html.haml @@ -1,4 +1,5 @@ %h1 your network stream += render "status_messages/new_status_message" %ul#stream - for post in @posts = render type_partial(post), :post => post diff --git a/app/views/friends/_sidebar.html.haml b/app/views/friends/_sidebar.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..e7b34969fe4afaf1bb5f289bc39a0090f34865e2 --- /dev/null +++ b/app/views/friends/_sidebar.html.haml @@ -0,0 +1,8 @@ +%h1 your friends +%ul#stream + - for friend in @friends + = link_to friend.real_name, friend_path(friend) + %br + %br + %hr + = link_to "add a new friend", new_friend_path \ No newline at end of file diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 5bf2d41a2a834ecb23dd17574bbe766c4e4e1b2a..2639d74cce37babd9a6e85a98125e96036b63995 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -82,5 +82,8 @@ #content - = yield - = render "posts/debug" + #main + = yield + = render "posts/debug" + #friends_list + = render 'friends/sidebar' \ No newline at end of file diff --git a/app/views/status_messages/_new_status_message.haml b/app/views/status_messages/_new_status_message.haml index 5e3ac866380e00dc8722aefc2e3b34c5daaf09eb..d8cb1d3284fb47dfd41ddf794c0fc422c9177ce0 100644 --- a/app/views/status_messages/_new_status_message.haml +++ b/app/views/status_messages/_new_status_message.haml @@ -1,4 +1,4 @@ -= form_for status_message, :remote => true do |f| += form_for StatusMessage.new, :remote => true do |f| = f.error_messages %p /= f.label :message diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 9cfea05ebd535dadfae3311abbae313e4be2ed73..599de669cf39a35bb59749ed77671f1b604781e0 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -177,6 +177,18 @@ h3 { width: 100%; margin-bottom: 1em; } +#main { + width: 70%; + min-width: 400px; + max-width: 700px; + float: left; } + +#friends_list { + float: right; + width: 20%; + min-width: 130px; + padding-left: 10%; } + form { font-size: 130%; margin: 1em; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index ff34a75659ce6f4da2b20b60872b94041dcca99b..9e13e0657a3fad58b6873d9b81a640665c44b6a4 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -214,7 +214,19 @@ h3 :width 100% :margin :bottom 1em - + +#main + :width 70% + :min-width 400px + :max-width 700px + :float left + +#friends_list + :float right + :width 20% + :min-width 130px + :padding-left 10% + form :font :size 130% diff --git a/spec/controllers/dashboard_controller_spec.rb b/spec/controllers/dashboard_controller_spec.rb index b6ad08b93ce4922964e0e326f67573779c795bb2..f37e422d0e03e3ebe9fb4cd349b7af33c8d89094 100644 --- a/spec/controllers/dashboard_controller_spec.rb +++ b/spec/controllers/dashboard_controller_spec.rb @@ -3,10 +3,19 @@ require File.dirname(__FILE__) + '/../spec_helper' describe DashboardController do render_views - it "index action should render index template" do + before do request.env['warden'] = mock_model(Warden, :authenticate? => @user, :authenticate! => @user) + end + + it "index action should render index template" do get :index response.should render_template(:index) end + + it "on index sets a friends variable" do + Factory.create :friend + get :index + assigns[:friends].should == Friend.all + end end