From aa7343d759be9c4525a36e22fd56e66f32e79457 Mon Sep 17 00:00:00 2001 From: danielgrippi <danielgrippi@gmail.com> Date: Tue, 29 Nov 2011 14:41:46 -0800 Subject: [PATCH] add profile streams to backbone. this breaks hovercards, atm. --- app/controllers/people_controller.rb | 10 ++++++---- app/views/people/show.html.haml | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index f0d614f1c6..fc99d89d57 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -84,6 +84,8 @@ class PeopleController < ApplicationController end def show + @backbone = true + @person = Person.find_from_id_or_username(params) if remote_profile_with_no_user_session? @@ -124,13 +126,13 @@ class PeopleController < ApplicationController end if params[:only_posts] - render :partial => 'shared/stream', :locals => {:posts => @stream.stream_posts} + respond_to do |format| + format.html{ render :partial => 'shared/stream', :locals => {:posts => @stream.stream_posts} } + end else respond_to do |format| format.all { respond_with @person, :locals => {:post_type => :all} } - format.json { - render :json => @person.to_json(:includes => params[:includes]) - } + format.json{ render :json => @stream.stream_posts.to_json(:include => {:author => {:include => :profile}}) } end end end diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index 5fcb79d022..02e3c94d8a 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -27,14 +27,15 @@ = render 'people/sub_header', :person => @person, :contact => @contact / hackity hack until we get a photo stream - - if (@posts && @posts.length > 0) || (@stream && @stream.stream_posts.length > 0) + - if @backbone && (@posts && @posts.length > 0) || (@stream && @stream.stream_posts.length > 0) -if @post_type == :photos = render 'photos/index', :photos => @posts - else #main_stream.stream - = render 'shared/stream', :posts => @stream.stream_posts - #pagination - =link_to(t('more'), next_page_path, :class => 'paginate') + - if !@backbone + = render 'shared/stream', :posts => @stream.stream_posts + #pagination + =link_to(t('more'), next_page_path, :class => 'paginate') - else #main_stream -- GitLab