Module: Kinney::Concerns::Models::Person

Extended by:
ActiveSupport::Concern
Included in:
Person
Defined in:
lib/concerns/models/person.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#full_nameObject



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

#imageObject



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


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_bioObject



79
80
81
# File 'lib/concerns/models/person.rb', line 79

def short_bio
  HTML_Truncator.truncate(biography, 20).html_safe
end

#short_bio_textObject



83
84
85
# File 'lib/concerns/models/person.rb', line 83

def short_bio_text
  Nokogiri::HTML(short_bio).text
end

#to_labelObject



66
67
68
# File 'lib/concerns/models/person.rb', line 66

def to_label
  "#{last_name}, #{first_name}"
end

#top_pick_clipObject



62
63
64
# File 'lib/concerns/models/person.rb', line 62

def top_pick_clip
  clips.where(:top_pick => true).limit(1).first
end