DG MS cleaning up friend request

This commit is contained in:
maxwell 2010-07-08 12:05:06 -07:00
parent da4e148fed
commit 1fa2dfd6eb
13 changed files with 8 additions and 87 deletions

View file

@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base
end
def set_people
@people = Person.all
@people = Person.friends.all
end
end

View file

@ -2,7 +2,7 @@ class PeopleController < ApplicationController
before_filter :authenticate_user!
def index
@people = Person.paginate :page => params[:page], :order => 'created_at DESC'
@people = Person.friends.paginate :page => params[:page], :order => 'created_at DESC'
end
def show

View file

@ -26,7 +26,7 @@ class PersonRequestsController < ApplicationController
def create
@person_request = PersonRequest.for(params[:person_request][:url])
if true
if @person_request
flash[:notice] = "Successfully created person request."
redirect_to @person_request
else

View file

@ -22,7 +22,7 @@ class Person
#validates_uniqueness_of :url
validates_true_for :url, :logic => lambda { self.url_unique?}
scope :friends, where(:_type => "Person")
validates_presence_of :email
before_validation :clean_url

View file

@ -1,5 +0,0 @@
%h3 your friends
%ul#friend_stream.nav
- for friend in @friends
%li= link_to friend.real_name, friend_path(friend)
/= link_to "add a new friend", new_friend_path

View file

@ -1,19 +0,0 @@
- title "Friends"
%table
%tr
%th real name
%th email
%th url
- for friend in @friends
%tr
%td= friend.real_name
%td= friend.email
%td= friend.url
%td= link_to 'Show', friend
%td= link_to 'Destroy', friend, :confirm => 'Are you sure?', :method => :delete
%p= link_to "New Friend", new_friend_path
#pagination
= will_paginate @friends

View file

@ -1,27 +0,0 @@
- title "New Friend"
= form_for @friend do |f|
= f.error_messages
%p
= f.label :email
%br
= f.text_field :email
%p
= f.label :url
%br
= f.text_field :url
=f.fields_for :profile do |p|
%p
= p.label :first_name
%br
= p.text_field :first_name
%p
= p.label :last_name
%br
= p.text_field :last_name
= f.submit
%p= link_to "Back to List", friends_path

View file

@ -1,24 +0,0 @@
.span-18.last
%h1= "#{@friend.real_name}"
- if @friend_profile
%p
%b First Name
%p
= @friend_profile.first_name
%p
%b Last Name
%p
= @friend_profile.last_name
%p
%b url
%p
= @friend.url
.span-18
- if @friend.posts
%h3 stream
%ul#stream
- for post in @friend_posts
= render type_partial(post), :post => post
- else
%h3 no posts to display!

View file

@ -17,7 +17,7 @@
= yield(:head)
/= javascript_include_tag 'satisfaction' , 'satisfaction-display'
= javascript_include_tag 'satisfaction' , 'satisfaction-display'
%body
%header
.container
@ -43,7 +43,7 @@
#content.span-24.last
.span-3.append-1.last
= link_to owner_picture, root_path
/= render 'friends/sidebar' if user_signed_in?
= render 'people/sidebar' if user_signed_in?
.span-20
- if user_signed_in?

View file

@ -2,4 +2,4 @@
%ul#friend_stream.nav
- for person in @people
%li= link_to person.real_name, person_path(person)
/= link_to "add a new friend", new_friend_path
= link_to "add a new person", new_person_path

View file

@ -29,9 +29,6 @@ module Diaspora
def store_objects_from_xml(xml)
objects = parse_objects_from_xml(xml)
puts xml
objects.each do |p|
if p.is_a? Retraction
p.perform

View file

@ -16,7 +16,7 @@ describe DashboardController do
it "on index sets a person's variable" do
Factory.create :person
get :index
assigns[:people].should == Person.all
assigns[:people].should == Person.friends.all
end
end

View file

@ -121,7 +121,6 @@ describe "parser in application helper" do
Person.count.should be 0
store_objects_from_xml(xml)
Person.count.should be 1
puts Person.first.inspect
end
it "should activate the Person if I initiated a request to that url" do