Module: GenericFormFor::Actions::Base::Icon

Defined in:
lib/generic_form_for/actions/base/icon.rb

Instance Method Summary collapse

Instance Method Details

#icon_html(config_options = {}) ⇒ Object



6
7
8
9
# File 'lib/generic_form_for/actions/base/icon.rb', line 6

def icon_html(config_options={})
  return "" unless render_icon?
  template.(config_options.delete(:tag) || :span, "", icon_html_options(config_options))
end

#icon_html_options(config_options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/generic_form_for/actions/base/icon.rb', line 11

def icon_html_options(config_options={})
  opts = (options[:icon_html] || {}).dup
  opts[:class] = [*options[:icon], *opts[:class], *config_options[:class]].compact.join(' ').strip
  config_options.merge(opts)
end

#render_icon?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/generic_form_for/actions/base/icon.rb', line 17

def render_icon?
  options.key?(:icon)
end