Sha256: 2b226c04435aeb8fd6540bc8f2fac89c7d367259d8d489d39acbbadb22d62c81

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

<%
  control_group_class  = 'control-group'
  control_group_class << " cg-#{options[:method].to_s.dasherize}" if options[:method]
  control_group_class << ' error'                                 if options[:errors]
%>

<%= content_tag(:div, :class => control_group_class) do %>
  
  <% unless options[:label] == '' %>
    <%= content_tag(:div, :class => 'control-label') do %>
      <% if options[:choices].size == 1 %>
        <%= options[:builder].label(options[:method], options[:label]) %>
      <% else %>
        <%= options[:label] || options[:method].to_s.humanize %>
      <% end %>
    <% end %>
  <% end %>
  
  <%= content_tag(:div, :class => 'controls') do %>
    <% options[:choices].each do |field, label, inline| %>
      <% if options[:choices].size == 1 %>
        <%= field %>
      <% else%>
        <% label_class = options[:field_name].to_s.gsub(/(_button$|_)/, '') %>
        <% label_class << ' inline' if inline %>
        <%= content_tag(:label, :class => label_class) do %>
          <%= field %><%= label %>
        <% end %>
      <% end %>
    <% 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/_choices.html.erb
formatted_form-2.0.3 app/views/formatted_form/templates/_choices.html.erb
formatted_form-2.0.2 app/views/formatted_form/templates/_choices.html.erb
formatted_form-2.0.1 app/views/formatted_form/templates/_choices.html.erb
formatted_form-2.0.0 app/views/formatted_form/templates/_choices.html.erb