module SocialColorsRails module ApplicationHelper include ::FontAwesome::Rails::IconHelper ### # # Create social link tag given name, url and possible title, style, size and nofollow modifiers. # # Examples : # ### # # social_tag "github", "https://github.com/TimVille" # => # # # ### # # social_tag "github", "https://github.com/TimVille", style: "square" # => # # # ### # # social_tag "github", "https://github.com/TimVille", size: "2x" # => # # # ### # # social_tag "github", "https://github.com/TimVille", style: "square-o", size: "3x" # => # # # ### # # social_tag "github", "https://github.com/TimVille", size: "3x", title: "My awesome link title" # => # # # ### def social_tag(name = "facebook", href = "#", url: nil, title: nil, style: "circle", size: nil, external: true, nofollow: true) classes = "icon-stack stack-#{style} #{name}" + (size.nil? ? "" : " stack-#{size}") location = href options = { class: classes, target: "_blank", } if !url.nil? location = url end if external options[:rel] = "external" + (nofollow ? " nofollow" : "") end if !title.nil? options[:title] = title end html = link_to(fa_icon(name), location, options) html end end end