Method: Para::TagHelper#icon_link_to

Defined in:
app/helpers/para/tag_helper.rb


3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/para/tag_helper.rb', line 3

def icon_link_to(name, url_options = nil, options = nil, &block)
  if block
    options, url_options = url_options, name
    name = capture { block.call }
  end

  if (icon = options.delete(:icon))
    icon_tag = (:i, '', class: "fa fa-#{ icon }")
    name = [icon_tag, name].join(' ').html_safe
  end

  link_to(name, url_options, options)
end