MS^2 Added the friends panel to application layout
This commit is contained in:
parent
a89e0d4a7f
commit
4d65cfab09
6 changed files with 54 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
8
app/views/friends/_sidebar.html.haml
Normal file
8
app/views/friends/_sidebar.html.haml
Normal file
|
|
@ -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
|
||||
|
|
@ -84,5 +84,8 @@
|
|||
|
||||
|
||||
#content
|
||||
= yield
|
||||
= render "posts/debug"
|
||||
#main
|
||||
= yield
|
||||
= render "posts/debug"
|
||||
#friends_list
|
||||
= render 'friends/sidebar'
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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%
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue