user has a image url field for user picture

This commit is contained in:
danielvincent 2010-07-16 23:02:24 -07:00
parent 5637ab2a8e
commit 04eb66b2e6
9 changed files with 42 additions and 24 deletions

View file

@ -37,15 +37,15 @@ module ApplicationHelper
link_to person.real_name, person_url(person) link_to person.real_name, person_url(person)
end end
def owner_picture def owner_image_tag
default = "/images/user/default.jpg" person_image_tag(User.owner)
image = "/images/user/#{User.owner.profile.last_name.gsub(/ /,'').downcase}.jpg" end
if File.exist?("public/images/user/#{User.owner.profile.last_name.gsub(/ /,'').downcase}.jpg") def person_image_tag(person)
image_tag image, :id => "user_picture" image_location = person.profile.image_url
else image_location ||= "/images/user/default.jpg"
image_tag default, :id => "user_picture"
end image_tag image_location, :class => "person_picture"
end end
def new_request(request_count) def new_request(request_count)

View file

@ -1,4 +1,4 @@
class Photo class Photo < Post
require 'carrierwave/orm/mongomapper' require 'carrierwave/orm/mongomapper'
include MongoMapper::Document include MongoMapper::Document

View file

@ -7,6 +7,7 @@ class Profile
key :first_name, String key :first_name, String
key :last_name, String key :last_name, String
key :image_url, String
validates_presence_of :first_name, :last_name validates_presence_of :first_name, :last_name

View file

@ -1,4 +1,5 @@
%li.comment{:id => post.id} %li.comment{:id => post.id}
= person_image_tag(post.person)
%span.from %span.from
= link_to_person post.person = link_to_person post.person
= auto_link post.text = auto_link post.text

View file

@ -43,7 +43,7 @@
.container .container
.span-24.last .span-24.last
.span-3.append-1.last .span-3.append-1.last
= link_to owner_picture, root_path = link_to person_image_tag(User.owner), root_path
= link_to "Edit your profile", edit_user_path(current_user) = link_to "Edit your profile", edit_user_path(current_user)
%br %br
%br %br

View file

@ -1,4 +1,7 @@
%li.message{:id => post.id, :class => ("mine" if mine?(post))} %li.message{:id => post.id, :class => ("mine" if mine?(post))}
= person_image_tag(post.person)
%span.from %span.from
= link_to post.person.real_name, post.person = link_to post.person.real_name, post.person
= auto_link post.message = auto_link post.message

View file

@ -10,6 +10,9 @@
%p %p
= p.label :last_name = p.label :last_name
= p.text_field :last_name, :value => @profile.last_name = p.text_field :last_name, :value => @profile.last_name
%p
= p.label :image_url
= p.text_field :image_url, :value => @profile.image_url
%p %p
= f.label :email = f.label :email

View file

@ -118,7 +118,7 @@ ul#stream, ul#friend_stream {
color: #666666; } color: #666666; }
ul#stream > li, ul#friend_stream > li { ul#stream > li, ul#friend_stream > li {
list-style: none; list-style: none;
padding: 1em 0; padding: 15px 0;
border-bottom: 1px solid #f1f1f1; border-bottom: 1px solid #f1f1f1;
margin-bottom: 5px; } margin-bottom: 5px; }
@ -190,13 +190,18 @@ ul.comment_set {
margin-top: -5px; margin-top: -5px;
padding-bottom: 8px; } padding-bottom: 8px; }
img#profile_picture { img.person_picture {
width: 100%; } max-width: 100%;
img#user_picture {
width: 100%;
border-radius: 3px; border-radius: 3px;
-moz-border-radius: 3px; } -moz-border-radius: 3px;
display: inline block; }
li.message > img.person_picture,
li.comment > img.person_picture {
height: 30px;
display: absolute;
float: left;
margin-right: 10px; }
.pagination a { .pagination a {
padding: 3px; } padding: 3px; }

View file

@ -130,7 +130,7 @@ ul#stream, ul#friend_stream
:color #666 :color #666
> li > li
:list-style none :list-style none
:padding 1em 0 :padding 15px 0
:border :border
:bottom 1px solid #f1f1f1 :bottom 1px solid #f1f1f1
:margin-bottom 5px :margin-bottom 5px
@ -227,14 +227,19 @@ ul.comment_set
:padding :padding
:bottom 8px :bottom 8px
img.person_picture
img#profile_picture :max-width 100%
:width 100%
img#user_picture
:width 100%
:border-radius 3px :border-radius 3px
:-moz-border-radius 3px :-moz-border-radius 3px
:display inline block
li.message > img.person_picture,
li.comment > img.person_picture
:height 30px
:display absolute
:float left
:margin
:right 10px
.pagination .pagination
a a