app/helpers/tramway/profiles/links_helper.rb in tramway-profiles-1.4.0.1 vs app/helpers/tramway/profiles/links_helper.rb in tramway-profiles-1.4.1
- old
+ new
@@ -1,36 +1,25 @@
# frozen_string_literal: true
module Tramway::Profiles::LinksHelper
def profile_link(profile)
- send profile.network_name, profile.uid, profile.title
+ profile_link_template profile.title, profile_url(profile), profile.network_name
end
- private
+ DOMAINS = {
+ vk: 'vk.com',
+ facebook: 'facebook.com',
+ twitter: 'twitter.com',
+ instagram: 'instagram.com',
+ telegram: 'intg.me',
+ patreon: 'patreon.com'
+ }.with_indifferent_access
- def vk(uid, title)
- profile_link_template title, "https://vk.com/#{uid}", :vk
+ def profile_url(profile)
+ "https://#{DOMAINS[profile.network_name]}/#{profile.uid}"
end
- def facebook(uid, title)
- profile_link_template title, "https://facebook.com/#{uid}", :facebook
- end
-
- def twitter(uid, title)
- profile_link_template title, "https://twitter.com/#{uid}", :twitter
- end
-
- def instagram(uid, title)
- profile_link_template title, "https://instagram.com/#{uid}", :instagram
- end
-
- def telegram(uid, title)
- profile_link_template title, "https://intg.me/#{uid}", :telegram
- end
-
- def patreon(uid, title)
- profile_link_template title, "https://patreon.com/#{uid}", :patreon
- end
+ private
def profile_link_template(title, link, icon)
link_to link, target: '_blank' do
concat fab_icon icon
concat ' '