Created Application Helpers based on suggestion for easier parsing
This commit is contained in:
parent
d5049022a7
commit
d6697e0b4d
2 changed files with 21 additions and 2 deletions
|
@ -278,4 +278,23 @@ module ApplicationHelper
|
||||||
def show_user_callout?
|
def show_user_callout?
|
||||||
cookies[:user_callout_dismissed] == 'true'
|
cookies[:user_callout_dismissed] == 'true'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def linkedin_url(user)
|
||||||
|
name = user.linkedin
|
||||||
|
if name =~ %r{\Ahttps?:\/\/(www\.)?linkedin\.com\/in\/(.*)\z}
|
||||||
|
name
|
||||||
|
else
|
||||||
|
"https://www.linkedin.com/in/#{name}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def twitter_url(user)
|
||||||
|
name = user.twitter
|
||||||
|
if name =~ %r{\Ahttps?:\/\/(www\.)?twitter\.com\/(.*)\z}
|
||||||
|
name
|
||||||
|
else
|
||||||
|
"https://www.twitter.com/#{name}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,11 +56,11 @@
|
||||||
= icon('skype')
|
= icon('skype')
|
||||||
- unless @user.linkedin.blank?
|
- unless @user.linkedin.blank?
|
||||||
.profile-link-holder.middle-dot-divider
|
.profile-link-holder.middle-dot-divider
|
||||||
= link_to "https://www.linkedin.com/in/#{@user.linkedin.gsub(/https:\/\/www.linkedin.com\/in\//i,'')}", title: "LinkedIn" do
|
= link_to linkedin_url(@user), title: "LinkedIn" do
|
||||||
= icon('linkedin-square')
|
= icon('linkedin-square')
|
||||||
- unless @user.twitter.blank?
|
- unless @user.twitter.blank?
|
||||||
.profile-link-holder.middle-dot-divider
|
.profile-link-holder.middle-dot-divider
|
||||||
= link_to "https://twitter.com/#{@user.twitter.gsub(/https:\/\/twitter.com\//i,'')}", title: "Twitter" do
|
= link_to twitter_url(@user), title: "Twitter" do
|
||||||
= icon('twitter-square')
|
= icon('twitter-square')
|
||||||
- unless @user.website_url.blank?
|
- unless @user.website_url.blank?
|
||||||
.profile-link-holder.middle-dot-divider
|
.profile-link-holder.middle-dot-divider
|
||||||
|
|
Loading…
Reference in a new issue