Module: StrokeSeven::Rails::IconHelper

Defined in:
app/helpers/stroke_seven/rails/icon_helper.rb

Defined Under Namespace

Modules: Private

Instance Method Summary collapse

Instance Method Details

#s7_icon(names = "album", options = {}) ⇒ Object

Creates an icon tag given an icon name and possible icon modifiers.

Examples

s7_icon "album"
# => <i class="pe-7s-album"></i>

s7_icon "album", class: "pull-left"
# => <i class="pe-7s-album pull-left"></i>

s7_icon "album", data: { id: 123 }
# => <i class="pe-7s-album" data-id="123"></i>

(:li, s7_icon("album", text: "Bulleted list item"))
# => <li><i class="pe-7s-album"></i> Bulleted list item</li>


20
21
22
23
24
25
26
27
28
# File 'app/helpers/stroke_seven/rails/icon_helper.rb', line 20

def s7_icon(names = "album", options = {})
  classes = []
  classes.concat Private.icon_names(names)
  classes.concat Array(options.delete(:class))
  text = options.delete(:text)
  right_icon = options.delete(:right)
  icon = (:i, nil, options.merge(:class => classes))
  Private.icon_join(icon, text, right_icon)
end