Sha256: 292fa7c68145eea41532cf34f257eb089bb0cd10aed5d026f8fe487fd32d1b86

Contents?: true

Size: 1.56 KB

Versions: 5

Compression:

Stored size: 1.56 KB

Contents

<%
  inline_form = [:inline, :search].member?(options[:builder].options[:type])
  
  control_group_class  = 'control-group'
  control_group_class << " cg-#{options[:method].to_s.dasherize}" if options[:method]
  control_group_class << ' error'                                 if options[:errors]
  
  if ([:prepend, :append, :prepend_html, :append_html] & options.keys).present?
    wrapper_class = "#{wrapper_class} input-prepend".strip  if options[:prepend]  || options[:prepend_html]
    wrapper_class = "#{wrapper_class} input-append".strip   if options[:append]   || options[:append_html]
  end
%>

<%= content_tag_unless(inline_form, :div, :class => control_group_class) do %>
  
  <% unless ['', false].include?(options[:label]) %>
    <%= options[:builder].label(options[:method], options[:label], :class => 'control-label') %>
  <% end %>
  
  <%= content_tag_unless(inline_form, :div, :class => 'controls') do %>
    
    <%= content_tag_if(wrapper_class, :div, :class => wrapper_class) do %>
      <%= options[:prepend_html].html_safe if options[:prepend_html] %>
      <%= content_tag(:span, options[:prepend], :class => 'add-on') if options[:prepend] %>
      <%= options[:content] %>
      <%= content_tag(:span, options[:append], :class => 'add-on') if options[:append] %>
      <%= options[:append_html].html_safe if options[:append_html] %>
    <% end %>
    
    <%= content_tag(:span, options[:errors], :class => 'help-inline') if options[:errors] %>
    <%= content_tag(:span, options[:help_block], :class => 'help-block') if options[:help_block] %>
  <% end %>
  
<% end %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
formatted_form-2.0.4 app/views/formatted_form/templates/_field.html.erb
formatted_form-2.0.3 app/views/formatted_form/templates/_field.html.erb
formatted_form-2.0.2 app/views/formatted_form/templates/_field.html.erb
formatted_form-2.0.1 app/views/formatted_form/templates/_field.html.erb
formatted_form-2.0.0 app/views/formatted_form/templates/_field.html.erb