DG MS cleaning up friend request
This commit is contained in:
parent
da4e148fed
commit
1fa2dfd6eb
13 changed files with 8 additions and 87 deletions
|
|
@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_people
|
def set_people
|
||||||
@people = Person.all
|
@people = Person.friends.all
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class PeopleController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@people = Person.paginate :page => params[:page], :order => 'created_at DESC'
|
@people = Person.friends.paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class PersonRequestsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
@person_request = PersonRequest.for(params[:person_request][:url])
|
@person_request = PersonRequest.for(params[:person_request][:url])
|
||||||
|
|
||||||
if true
|
if @person_request
|
||||||
flash[:notice] = "Successfully created person request."
|
flash[:notice] = "Successfully created person request."
|
||||||
redirect_to @person_request
|
redirect_to @person_request
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class Person
|
||||||
#validates_uniqueness_of :url
|
#validates_uniqueness_of :url
|
||||||
validates_true_for :url, :logic => lambda { self.url_unique?}
|
validates_true_for :url, :logic => lambda { self.url_unique?}
|
||||||
|
|
||||||
|
scope :friends, where(:_type => "Person")
|
||||||
validates_presence_of :email
|
validates_presence_of :email
|
||||||
|
|
||||||
before_validation :clean_url
|
before_validation :clean_url
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -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!
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
= yield(:head)
|
= yield(:head)
|
||||||
|
|
||||||
|
|
||||||
/= javascript_include_tag 'satisfaction' , 'satisfaction-display'
|
= javascript_include_tag 'satisfaction' , 'satisfaction-display'
|
||||||
%body
|
%body
|
||||||
%header
|
%header
|
||||||
.container
|
.container
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
#content.span-24.last
|
#content.span-24.last
|
||||||
.span-3.append-1.last
|
.span-3.append-1.last
|
||||||
= link_to owner_picture, root_path
|
= link_to owner_picture, root_path
|
||||||
/= render 'friends/sidebar' if user_signed_in?
|
= render 'people/sidebar' if user_signed_in?
|
||||||
|
|
||||||
.span-20
|
.span-20
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
%ul#friend_stream.nav
|
%ul#friend_stream.nav
|
||||||
- for person in @people
|
- for person in @people
|
||||||
%li= link_to person.real_name, person_path(person)
|
%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
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,6 @@ module Diaspora
|
||||||
|
|
||||||
def store_objects_from_xml(xml)
|
def store_objects_from_xml(xml)
|
||||||
objects = parse_objects_from_xml(xml)
|
objects = parse_objects_from_xml(xml)
|
||||||
|
|
||||||
puts xml
|
|
||||||
|
|
||||||
objects.each do |p|
|
objects.each do |p|
|
||||||
if p.is_a? Retraction
|
if p.is_a? Retraction
|
||||||
p.perform
|
p.perform
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ describe DashboardController do
|
||||||
it "on index sets a person's variable" do
|
it "on index sets a person's variable" do
|
||||||
Factory.create :person
|
Factory.create :person
|
||||||
get :index
|
get :index
|
||||||
assigns[:people].should == Person.all
|
assigns[:people].should == Person.friends.all
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,6 @@ describe "parser in application helper" do
|
||||||
Person.count.should be 0
|
Person.count.should be 0
|
||||||
store_objects_from_xml(xml)
|
store_objects_from_xml(xml)
|
||||||
Person.count.should be 1
|
Person.count.should be 1
|
||||||
puts Person.first.inspect
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should activate the Person if I initiated a request to that url" do
|
it "should activate the Person if I initiated a request to that url" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue