user has a image url field for user picture
This commit is contained in:
parent
5637ab2a8e
commit
04eb66b2e6
9 changed files with 42 additions and 24 deletions
|
|
@ -37,15 +37,15 @@ module ApplicationHelper
|
|||
link_to person.real_name, person_url(person)
|
||||
end
|
||||
|
||||
def owner_picture
|
||||
default = "/images/user/default.jpg"
|
||||
image = "/images/user/#{User.owner.profile.last_name.gsub(/ /,'').downcase}.jpg"
|
||||
|
||||
if File.exist?("public/images/user/#{User.owner.profile.last_name.gsub(/ /,'').downcase}.jpg")
|
||||
image_tag image, :id => "user_picture"
|
||||
else
|
||||
image_tag default, :id => "user_picture"
|
||||
def owner_image_tag
|
||||
person_image_tag(User.owner)
|
||||
end
|
||||
|
||||
def person_image_tag(person)
|
||||
image_location = person.profile.image_url
|
||||
image_location ||= "/images/user/default.jpg"
|
||||
|
||||
image_tag image_location, :class => "person_picture"
|
||||
end
|
||||
|
||||
def new_request(request_count)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Photo
|
||||
class Photo < Post
|
||||
require 'carrierwave/orm/mongomapper'
|
||||
include MongoMapper::Document
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Profile
|
|||
|
||||
key :first_name, String
|
||||
key :last_name, String
|
||||
key :image_url, String
|
||||
|
||||
validates_presence_of :first_name, :last_name
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
%li.comment{:id => post.id}
|
||||
= person_image_tag(post.person)
|
||||
%span.from
|
||||
= link_to_person post.person
|
||||
= auto_link post.text
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
.container
|
||||
.span-24.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)
|
||||
%br
|
||||
%br
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
%li.message{:id => post.id, :class => ("mine" if mine?(post))}
|
||||
|
||||
= person_image_tag(post.person)
|
||||
|
||||
%span.from
|
||||
= link_to post.person.real_name, post.person
|
||||
= auto_link post.message
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@
|
|||
%p
|
||||
= p.label :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
|
||||
= f.label :email
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ ul#stream, ul#friend_stream {
|
|||
color: #666666; }
|
||||
ul#stream > li, ul#friend_stream > li {
|
||||
list-style: none;
|
||||
padding: 1em 0;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
margin-bottom: 5px; }
|
||||
|
||||
|
|
@ -190,13 +190,18 @@ ul.comment_set {
|
|||
margin-top: -5px;
|
||||
padding-bottom: 8px; }
|
||||
|
||||
img#profile_picture {
|
||||
width: 100%; }
|
||||
|
||||
img#user_picture {
|
||||
width: 100%;
|
||||
img.person_picture {
|
||||
max-width: 100%;
|
||||
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 {
|
||||
padding: 3px; }
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ ul#stream, ul#friend_stream
|
|||
:color #666
|
||||
> li
|
||||
:list-style none
|
||||
:padding 1em 0
|
||||
:padding 15px 0
|
||||
:border
|
||||
:bottom 1px solid #f1f1f1
|
||||
:margin-bottom 5px
|
||||
|
|
@ -227,14 +227,19 @@ ul.comment_set
|
|||
:padding
|
||||
:bottom 8px
|
||||
|
||||
|
||||
img#profile_picture
|
||||
:width 100%
|
||||
|
||||
img#user_picture
|
||||
:width 100%
|
||||
img.person_picture
|
||||
:max-width 100%
|
||||
: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
|
||||
|
|
|
|||
Loading…
Reference in a new issue