Sha256: 47dd3280e47e7bf44290e3177c25efa2a6027a7c9c84e3a89084b8b450c72c66

Contents?: true

Size: 742 Bytes

Versions: 3

Compression:

Stored size: 742 Bytes

Contents

# TODO See if this can be refactored to make use of some of the Choices code.
module FormtasticBootstrap
  module Inputs
    class BooleanInput < Formtastic::Inputs::BooleanInput
      include Base

      def to_html
        control_group_div_wrapping do
          empty_label <<
          hidden_field_html <<
          input_div_wrapping(:block) do
            label_with_nested_checkbox
          end
        end
      end

      def label_html_options
        new_class = [super[:class], "checkbox"].compact.join(" ")
        super.merge(:class => new_class)
      end

      # Need this for formatting to work.
      def empty_label
        template.content_tag(:label, '', :class => 'control-label') do end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
speedo-formstrap-1.2.9 lib/formtastic-bootstrap/inputs/boolean_input.rb
speedo-formstrap-1.2.8 lib/formtastic-bootstrap/inputs/boolean_input.rb
speedo-formstrap-1.2.0 lib/formtastic-bootstrap/inputs/boolean_input.rb