From bdca2348a6d6d80a941f50bf7968f1d216504c7f Mon Sep 17 00:00:00 2001 From: maxwell <maxwell@joindiaspora.com> Date: Tue, 27 Jul 2010 14:23:31 -0700 Subject: [PATCH] MS IZ profile page has more useful info, but ultimatly kinda ugly --- app/controllers/dashboards_controller.rb | 2 + app/controllers/people_controller.rb | 4 +- app/helpers/application_helper.rb | 4 ++ app/helpers/status_messages_helper.rb | 2 +- app/views/people/_sidebar.html.haml | 3 +- app/views/people/show.html.haml | 59 +++++++++++++----------- app/views/posts/_debug.haml | 2 +- app/views/shared/_post_wrapper.haml | 4 ++ public/stylesheets/application.css | 5 +- public/stylesheets/sass/application.sass | 8 ++-- 10 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 app/views/shared/_post_wrapper.haml diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 414f5956ac..e09e182f8a 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -4,10 +4,12 @@ class DashboardsController < ApplicationController def index @posts = Post.paginate :page => params[:page], :order => 'created_at DESC' + @latest_status_message = StatusMessage.newest(current_user) end def ostatus @posts = OstatusPost.paginate :page => params[:page], :order => 'created_at DESC' + @latest_status_message = StatusMessage.newest(current_user) render :index end diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 44bdaf63ff..25fcdf2af7 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -8,7 +8,9 @@ class PeopleController < ApplicationController def show @person= Person.where(:id => params[:id]).first @person_profile = @person.profile - @person_posts = Post.where(:person_id => @person.id).sort(:created_at.desc) + @person_posts = Post.where(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC' + @latest_status_message = StatusMessage.newest(@person) + @post_count = @person_posts.count end def destroy diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8024717d81..2a9d7eda22 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -57,5 +57,9 @@ module ApplicationHelper def new_request(request_count) "new_requests" if request_count > 0 end + + def post_yield_tag(post) + (':' + post.id.to_s).to_sym + end end diff --git a/app/helpers/status_messages_helper.rb b/app/helpers/status_messages_helper.rb index 2e933d7843..a5655a9e35 100644 --- a/app/helpers/status_messages_helper.rb +++ b/app/helpers/status_messages_helper.rb @@ -1,7 +1,7 @@ module StatusMessagesHelper def my_latest_message - message = StatusMessage.my_newest + message = @latest_status_message unless message.nil? return message.message + " - " + how_long_ago(message) else diff --git a/app/views/people/_sidebar.html.haml b/app/views/people/_sidebar.html.haml index f9a205e1cc..438da560e3 100644 --- a/app/views/people/_sidebar.html.haml +++ b/app/views/people/_sidebar.html.haml @@ -12,5 +12,4 @@ - for author in @subscribed_persons %li= link_to author.username, author_path(author) -= link_to "add a new person", requests_path - += link_to "add a new person", requests_path \ No newline at end of file diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index ee08923158..54524ab085 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -1,29 +1,34 @@ .span-20.last - %h1= "#{@person.real_name}" - = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete -%p - %b Active? -%p - = @person.active -- if @person_profile - %p - %b First Name - %p - = @person_profile.first_name - %p - %b Last Name - %p - = @person_profile.last_name - %p - %b url - %p - = @person.url + #profile + %h1 + = person_image_link(@person) + = "#{@person.real_name}" + .button.right + = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete + + %h4{:style => "font-size:small"} + %ul{:style => "list-style-type: none"} + %li + %i= "last seen: #{how_long_ago(@person_posts.first)}" + %li + %i= "friends since: #{how_long_ago(@person)}" -.span-20 - - if @person.posts - %h3 stream - %ul#stream - - for post in @person_posts - = render type_partial(post), :post => post - - else - %h3 no posts to display! + %h1 + #latest_message= "\"#{@latest_status_message.message}\"" + + %p + %b url: + = @person.url + + + + + .span-20 + - if @person.posts + %h3= "stream - #{@post_count} item(s)" + %ul#stream + - for post in @person_posts + = render type_partial(post), :post => post + = will_paginate @person_posts + - else + %h3 no posts to display! diff --git a/app/views/posts/_debug.haml b/app/views/posts/_debug.haml index 75f8530680..ad1b3f1d82 100644 --- a/app/views/posts/_debug.haml +++ b/app/views/posts/_debug.haml @@ -1,6 +1,6 @@ #debug_info %h5 DEBUG INFO - #debug_more{:visability => "hidden"} + #debug_more{ :style => "display:none;" } %ul %li %b params diff --git a/app/views/shared/_post_wrapper.haml b/app/views/shared/_post_wrapper.haml new file mode 100644 index 0000000000..bdba9db700 --- /dev/null +++ b/app/views/shared/_post_wrapper.haml @@ -0,0 +1,4 @@ +%li.message{:id => post.id, :class => ("mine" if mine?(post))} + = person_image_link(post.person) + = yield post_yield_tag(post) + = = render type_partial(post), :post => post \ No newline at end of file diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index c1a4ea7d15..00b3cfc006 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -201,7 +201,7 @@ ul.comment_set { margin-top: -5px; padding-bottom: 8px; } -#stream img.person_picture { +#stream img.person_picture, #profile img.person_picture { border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; @@ -223,7 +223,8 @@ ul.comment_set { font-weight: normal; } .destroy_link { - display: none; } + display: none; + font-size: smaller; } .request_buttons { position: absolute; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 018a55c8b9..d65b0c44f7 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -242,8 +242,8 @@ ul.comment_set :top -5px :padding :bottom 8px - -#stream + +#stream, #profile img.person_picture :border-radius 3px :-webkit-border-radius 3px @@ -254,7 +254,8 @@ ul.comment_set :float left :margin :right 10px - + + .pagination a :padding 3px @@ -270,6 +271,7 @@ ul.comment_set .destroy_link :display none + :font-size smaller .request_buttons :position absolute -- GitLab