going to a non-friend's page contains a way to add them.
This commit is contained in:
parent
f2b7e4010e
commit
8ec49e685b
3 changed files with 52 additions and 16 deletions
|
|
@ -16,15 +16,24 @@ class PeopleController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@aspect = :profile
|
@aspect = :profile
|
||||||
@person = current_user.visible_person_by_id(params[:id])
|
|
||||||
unless @person
|
@person = Person.find(params[:id].to_id)
|
||||||
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
|
|
||||||
else
|
if @person
|
||||||
@profile = @person.profile
|
@profile = @person.profile
|
||||||
@contact = current_user.contact_for(@person)
|
@contact = current_user.contact_for(@person)
|
||||||
@aspects_with_person = @contact.aspects if @contact
|
|
||||||
|
if @contact
|
||||||
|
@aspects_with_person = @contact.aspects
|
||||||
|
else
|
||||||
|
@pending_request = current_user.pending_requests.find_by_person_id(@person.id)
|
||||||
|
end
|
||||||
|
|
||||||
@posts = current_user.visible_posts(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
|
@posts = current_user.visible_posts(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
respond_with @person
|
respond_with @person
|
||||||
|
else
|
||||||
|
flash[:error] = "Person does not exist!"
|
||||||
|
redirect_to people_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
- for aspect in @aspects_with_person
|
- for aspect in @aspects_with_person
|
||||||
%li= link_to aspect.name, aspect
|
%li= link_to aspect.name, aspect
|
||||||
|
|
||||||
- if @person != current_user.person && current_user.friends.include?(@person)
|
- if @person != current_user.person && @contact
|
||||||
= link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button"
|
= link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button"
|
||||||
|
|
||||||
- if @person == current_user.person
|
- if @person == current_user.person
|
||||||
|
|
@ -36,17 +36,43 @@
|
||||||
|
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
%ul
|
- if @person != current_user.person && @contact
|
||||||
%li= link_to 'stream', person_path(@person)
|
%ul
|
||||||
%li= link_to 'photos', person_photos_path(@person)
|
%li= link_to 'stream', person_path(@person)
|
||||||
|
%li= link_to 'photos', person_photos_path(@person)
|
||||||
|
|
||||||
|
|
||||||
.span-15.last
|
.span-15.last
|
||||||
- if @posts.count > 0
|
|
||||||
%ul#stream
|
- if @contact || current_user.person == @person
|
||||||
- for post in @posts
|
|
||||||
= render type_partial(post), :post => post unless post.class == Album
|
- if @posts.count > 0
|
||||||
= will_paginate @posts
|
%ul#stream
|
||||||
- else
|
- for post in @posts
|
||||||
%h3= t('.no_posts')
|
= render type_partial(post), :post => post unless post.class == Album
|
||||||
|
= will_paginate @posts
|
||||||
|
- else
|
||||||
|
%h3= t('.no_posts')
|
||||||
|
|
||||||
|
- else
|
||||||
|
|
||||||
|
.floating
|
||||||
|
%h3
|
||||||
|
= "You're currently not friends with #{@person.real_name}"
|
||||||
|
|
||||||
|
|
||||||
|
- unless @pending_request
|
||||||
|
%h3
|
||||||
|
.description
|
||||||
|
If you'd like, you can request to place him/her in one of your aspects.
|
||||||
|
|
||||||
|
= form_for Request.new do |f|
|
||||||
|
= f.select(:aspect_id, @aspects_dropdown_array)
|
||||||
|
= f.hidden_field :destination_url, :value => @person.diaspora_handle
|
||||||
|
= f.submit t('.add_friend')
|
||||||
|
|
||||||
|
- else
|
||||||
|
%h3
|
||||||
|
.description
|
||||||
|
= "You have already sent a request to #{@person.real_name}."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,7 @@ en:
|
||||||
are_you_sure: "Are you sure?"
|
are_you_sure: "Are you sure?"
|
||||||
remove_friend: "remove friend"
|
remove_friend: "remove friend"
|
||||||
no_posts: "no posts to display!"
|
no_posts: "no posts to display!"
|
||||||
|
add_friend: "add friend"
|
||||||
edit:
|
edit:
|
||||||
cancel: "Cancel"
|
cancel: "Cancel"
|
||||||
update_profile: "Update Profile"
|
update_profile: "Update Profile"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue