Sha256: f9e36009c4cab98a9f46b92dd9e7ec42b78cfc4d3d888425ea1325708140ffe4

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

<%
  cg_class = 'control-group'
  cg_class << ' error' if options[:errors].present?
  
  input_class = ''
  if ([:prepend, :append, :prepend_html, :append_html] & options.keys).present?
    input_class << ' input-prepend'  if options[:prepend]  || options[:prepend_html]
    input_class << ' input-append'   if options[:append]   || options[:append_html]
  end
  input_class.strip!
  
  error_class = options[:builder].options[:type] == :vertical ? 'help-block' : 'help-inline'
%>

<%= content_tag(:div, :class => cg_class) do %>
  
  <%= render :partial => 'formatted_form/templates/label', :locals => { :options => options } %>
  
  <%= content_tag(:div, :class => 'controls') do %>
    <%= content_tag(:div, :class => input_class) do %>
      <%= options[:prepend_html].html_safe if options[:prepend_html].present? %>
      <%= content_tag(:span, options[:prepend], :class => 'add-on') if options[:prepend].present? %>
      
      <%= options[:content] %>
      
      <%= content_tag(:span, options[:append], :class => 'add-on') if options[:append].present? %>
      <%= options[:append_html].html_safe if options[:append_html].present? %>
      
      <%= content_tag(:span, options[:errors], :class => error_class) if options[:errors].present? %>
      
      <%= content_tag(:span, options[:help_block], :class => 'help-block')   if options[:help_block].present? %>
      <%= content_tag(:span, options[:help_inline], :class => 'help-inline') if options[:help_inline].present? %>
    <% end %>
  <% end %>
<% end %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
formatted_form-2.1.2 app/views/formatted_form/templates/_field_block.html.erb
formatted_form-2.1.1 app/views/formatted_form/templates/_field_block.html.erb
formatted_form-2.1.0 app/views/formatted_form/templates/_field_block.html.erb