Module: Kinney::Concerns::Models::Person
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #full_name ⇒ Object
- #image ⇒ Object
- #read_more_link_params ⇒ Object
- #short_bio ⇒ Object
- #short_bio_text ⇒ Object
- #to_label ⇒ Object
- #top_pick_clip ⇒ Object
Instance Method Details
#full_name ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/concerns/models/person.rb', line 70 def full_name fn = '' fn << first_name if !first_name.blank? fn << ' ' + middle_name if !middle_name.blank? fn << ' ' + last_name if !last_name.blank? fn << ', ' + name_suffix if !name_suffix.blank? fn end |
#image ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/concerns/models/person.rb', line 87 def image image = images.where(:top_pick => true).limit(1).first if image.blank? image = images.first end image end |
#read_more_link_params ⇒ Object
95 96 97 98 99 100 101 102 |
# File 'lib/concerns/models/person.rb', line 95 def read_more_link_params read_more_link_params_hash = {:class => [:thumbnail, :person_read_more, :clearfix]} if !biography.blank? read_more_link_params_hash.merge!({:rel=> :popover, :'data-content' => short_bio_text, :'data-original-title' => full_name}) end read_more_link_params_hash end |
#short_bio ⇒ Object
79 80 81 |
# File 'lib/concerns/models/person.rb', line 79 def short_bio HTML_Truncator.truncate(biography, 20).html_safe end |
#short_bio_text ⇒ Object
83 84 85 |
# File 'lib/concerns/models/person.rb', line 83 def short_bio_text Nokogiri::HTML(short_bio).text end |
#to_label ⇒ Object
66 67 68 |
# File 'lib/concerns/models/person.rb', line 66 def to_label "#{last_name}, #{first_name}" end |
#top_pick_clip ⇒ Object
62 63 64 |
# File 'lib/concerns/models/person.rb', line 62 def top_pick_clip clips.where(:top_pick => true).limit(1).first end |