module SocialColorsRails module ApplicationHelper ### # # 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", url = "#", title: nil, style: "circle", size: nil, nofollow: true) classes = "icon-stack stack-#{style} #{name}" + (size.nil? ? "" : " stack-#{size}") options = { class: classes, target: "_blank", rel: "external" + (nofollow ? " nofollow" : "") } if !title.nil? options[:title] = title end html = link_to(fa_icon(name), url, options) html end end end