Skip to content

Instantly share code, notes, and snippets.

@yuri-zubov
Last active September 21, 2015 15:57
Show Gist options
  • Save yuri-zubov/952588818959f44c3a8f to your computer and use it in GitHub Desktop.
Save yuri-zubov/952588818959f44c3a8f to your computer and use it in GitHub Desktop.
class StringWithIconsInput < SimpleForm::Inputs::StringInput
def input(wrapper_options)
icons = options.fetch(:icons)
template.content_tag(:div, class: 'left-inner-addon') do
template.content_tag(:div, class: attribute_name.to_s.camelcase(:lower)) do
[
icons.map do |icon|
template.content_tag(:i, nil,class: "glyphicon glyphicon-#{icon}")
end,
super
].flatten.join.html_safe
end
end.html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment