diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index e8af2f337..89ed4bc9a 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -16,15 +16,24 @@ class PeopleController < ApplicationController def show @aspect = :profile - @person = current_user.visible_person_by_id(params[:id]) - unless @person - render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404 - else + + @person = Person.find(params[:id].to_id) + + if @person @profile = @person.profile @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' respond_with @person + else + flash[:error] = "Person does not exist!" + redirect_to people_path end end diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index 4ec8789f3..022955032 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -27,7 +27,7 @@ - for aspect in @aspects_with_person %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" - if @person == current_user.person @@ -36,17 +36,43 @@ %br %br - %ul - %li= link_to 'stream', person_path(@person) - %li= link_to 'photos', person_photos_path(@person) + - if @person != current_user.person && @contact + %ul + %li= link_to 'stream', person_path(@person) + %li= link_to 'photos', person_photos_path(@person) .span-15.last - - if @posts.count > 0 - %ul#stream - - for post in @posts - = render type_partial(post), :post => post unless post.class == Album - = will_paginate @posts - - else - %h3= t('.no_posts') + + - if @contact || current_user.person == @person + + - if @posts.count > 0 + %ul#stream + - for post in @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}." diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 7071d13d4..2702ff074 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -216,6 +216,7 @@ en: are_you_sure: "Are you sure?" remove_friend: "remove friend" no_posts: "no posts to display!" + add_friend: "add friend" edit: cancel: "Cancel" update_profile: "Update Profile"