Add user photos
This commit is contained in:
parent
6dd372511f
commit
6d415d44e3
17 changed files with 32339 additions and 76 deletions
BIN
app/assets/images/person_large.png
Normal file
BIN
app/assets/images/person_large.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
BIN
app/assets/images/person_small.png
Normal file
BIN
app/assets/images/person_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1 KiB |
BIN
app/assets/images/person_tiny.png
Normal file
BIN
app/assets/images/person_tiny.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 581 B |
|
|
@ -1,5 +1,5 @@
|
|||
class Person < ActiveRecord::Base
|
||||
attr_accessible :email, :first_name, :last_name, :public_name, :biography, :company
|
||||
attr_accessible :email, :first_name, :last_name, :public_name, :biography, :company, :avatar
|
||||
|
||||
has_many :event_people, :dependent => :destroy
|
||||
has_many :events, :through => :event_people, :uniq => true
|
||||
|
|
@ -11,6 +11,10 @@ class Person < ActiveRecord::Base
|
|||
before_create :generate_guid
|
||||
before_save :set_public_name
|
||||
|
||||
has_attached_file :avatar,
|
||||
:styles => {:tiny => "16x16>", :small => "32x32>", :large => "128x128>"},
|
||||
:default_url => "person_:style.png"
|
||||
validates_attachment_content_type :avatar, :content_type => [/jpg/, /jpeg/, /png/, /gif/]
|
||||
def to_s
|
||||
if self.public_name.empty?
|
||||
self.first_name + " " + self.last_name
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
= f.fields_for :person do |p|
|
||||
= p.inputs :first_name, :last_name, :public_name
|
||||
= p.input :company, :label => "Affiliation", :hint => "This could be a company, a user group, or nothing at all."
|
||||
= image_tag current_user.person.avatar(:small)
|
||||
= p.input :avatar, :label => "Picture", :hint => "Upload a new picture."
|
||||
= p.input :biography, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'biography-count')"}, :for => :person
|
||||
You have used
|
||||
%span#biography-count #{current_user.person.biography_word_count}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue