Module: PeopleHelper
- Defined in:
- app/helpers/people_helper.rb
Instance Method Summary collapse
- #display_location(person) ⇒ Object
- #facebook_path(person) ⇒ Object
- #github_path(person) ⇒ Object
- #google_plus_path(person) ⇒ Object
- #linked_in_path(person) ⇒ Object
- #twitter_path(person) ⇒ Object
Instance Method Details
#display_location(person) ⇒ Object
3 4 5 6 7 |
# File 'app/helpers/people_helper.rb', line 3 def display_location(person) return nil if (person.work_city.nil? && person.work_state.nil? && person.work_country.nil?) return "#{person.work_state} #{person.work_country}" if person.work_city.nil? return "#{person.work_city}, #{person.work_state} #{person.work_country}" end |
#facebook_path(person) ⇒ Object
13 14 15 16 |
# File 'app/helpers/people_helper.rb', line 13 def facebook_path(person) return "http#{$2}://www.facebook.com/#{$7}" if person.facebook =~ /(http)?(s)?(:\/\/)?(www.)?(facebook.com\/)?(.*\/)?(.*)/ return "http://www.facebook.com/#{person.facebook}" end |
#github_path(person) ⇒ Object
25 26 27 28 |
# File 'app/helpers/people_helper.rb', line 25 def github_path(person) return "http#{$1}://www.github.com/#{$2}" if person.github =~ /\[http\]?(s)?:\/\/\]?\[www\.\]?github\.com\/(.*)\/?/ return "http://www.github.com/#{person.github}" end |
#google_plus_path(person) ⇒ Object
21 22 23 24 |
# File 'app/helpers/people_helper.rb', line 21 def google_plus_path(person) return "http#{$2}://plus.google.com/#{$7}" if person.google_plus =~ /(http)?(s)?(:\/\/)?(www.)?(plus.google.com\/)?(.*\/)?(\d+)(.*)/ return "http://plus.google.com/#{person.google_plus}" end |
#linked_in_path(person) ⇒ Object
9 10 11 12 |
# File 'app/helpers/people_helper.rb', line 9 def linked_in_path(person) return "http#{$2}://www.linkedin.com/in/#{$7}" if person.linked_in =~ /(http)?(s)?(:\/\/)?(www.)?(linkedin.com\/)?(.*\/)?(.*)/ return "http://www.linkedin.com/in/#{person.linked_in}" end |
#twitter_path(person) ⇒ Object
17 18 19 20 |
# File 'app/helpers/people_helper.rb', line 17 def twitter_path(person) return "http#{$1}://www.twitter.com/#{$2}" if person.twitter =~ /\[http\]?(s)?:\/\/\]?\[www\.\]?twitter\.com\/(.*)\/?/ return "http://www.twitter.com/#{person.twitter}" end |