Sha256: fbf8c31ae58084fc275cfcdcaa591b7e41b61131dfbb286317a60905cf93efe3
Contents?: true
Size: 739 Bytes
Versions: 7
Compression:
Stored size: 739 Bytes
Contents
module Railsstrap module GlyphHelper # ==== Examples # glyph(:share_alt) # # => <span class="icon-share-alt"></span> # glyph(:lock, :white) # # => <span class="icon-lock icon-white"></span> # glyph(:thumbs_up, :pull_left) # # => <i class="icon-thumbs-up pull-left"></i> # glyph(:lock, {tag: :span}) # # => <span class="icon-lock"></span> def glyph(*names) options = (names.last.kind_of?(Hash)) ? names.pop : {} names.map! { |name| name.to_s.gsub('_','-') } names.map! do |name| name =~ /pull-(?:left|right)/ ? name : "glyphicon glyphicon-#{name}" end options[:tag] = options[:tag] ||= :i content_tag options[:tag], nil, :class => names end end end
Version data entries
7 entries across 7 versions & 1 rubygems