Class: RssIconInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
app/inputs/rss_icon_input.rb

Overview

Output HTML for a RSS input form field.

The HTML generated is compatible with Bootstrap, and it prepends an rss icon (from FontAwesome) before the input.

This class is intended to be used from simple_form forms like this:

<%= simple_form_for user, wrapper: :prepend do %>
  <%= f.input :rss, as: :rss_icon %>
  ...
<% end %>

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object


15
16
17
18
# File 'app/inputs/rss_icon_input.rb', line 15

def input(wrapper_options)
  input_html_options[:placeholder] ||= I18n.t 'simple_form.placeholders.subscription.rss'
  "<span class=\"input-group-addon\"><i class=\"fa fa-fw fa-rss\"></i></span>#{@builder.text_field(attribute_name, input_html_options)}".html_safe
end