Sha256: 40f952b53ff7c5df720c8948f0824cf72aa8af49a0131403098b484e1baedc5b

Contents?: true

Size: 664 Bytes

Versions: 5

Compression:

Stored size: 664 Bytes

Contents

# frozen_string_literal: true

module Tramway::Profiles::LinksHelper
  def profile_link(profile)
    profile_link_template profile.title, profile_url(profile), profile.network_name
  end

  DOMAINS = {
    vk: 'vk.com',
    facebook: 'facebook.com',
    twitter: 'twitter.com',
    instagram: 'instagram.com',
    telegram: 'intg.me',
    patreon: 'patreon.com'
  }.with_indifferent_access

  def profile_url(profile)
    "https://#{DOMAINS[profile.network_name]}/#{profile.uid}"
  end

  private

  def profile_link_template(title, link, icon)
    link_to link, target: '_blank' do
      concat fab_icon icon
      concat ' '
      concat title
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tramway-profiles-1.4.1.4 app/helpers/tramway/profiles/links_helper.rb
tramway-profiles-1.4.1.3 app/helpers/tramway/profiles/links_helper.rb
tramway-profiles-1.4.1.2 app/helpers/tramway/profiles/links_helper.rb
tramway-profiles-1.4.1.1 app/helpers/tramway/profiles/links_helper.rb
tramway-profiles-1.4.1 app/helpers/tramway/profiles/links_helper.rb