Sha256: d2a037e68fd9b9b261e618cf717cc7d2511e892363cf12528673e1c0d4b037de

Contents?: true

Size: 948 Bytes

Versions: 10

Compression:

Stored size: 948 Bytes

Contents

module FlexaFormtasticBootstrap
  module Inputs
    class BooleanInput < Formtastic::Inputs::BooleanInput
      include Base

      def to_html
        
        #options[:boolean][:class] = 'checkbox'
        
        #label_html_options.merge()
        
        clearfix_div_wrapping do
          #empty_label <<
          hidden_field_html <<
          input_div_wrapping(:block) do

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

      def label_text_with_embedded_checkbox
        # That newline matters!  Why, I do no not know.
        check_box_html << "\n" << template.content_tag(:span) do label_text end
      end

      # Need this for formatting to work.
      def empty_label
        template.content_tag(:label) do end
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
flexa_lib-0.5.2 lib/flexa_formtastic_bootstrap/inputs/boolean_input.rb
flexa_lib-0.5.1 lib/flexa_formtastic_bootstrap/inputs/boolean_input.rb
flexa_lib-0.5.0 lib/flexa_formtastic_bootstrap/inputs/boolean_input.rb
flexa_lib-0.3.9 lib/flexa_formtastic_bootstrap/inputs/boolean_input.rb
flexa_lib-0.3.8 lib/flexa_lib/inputs/boolean_input.rb
flexa_lib-0.3.7 lib/flexa_lib/inputs/boolean_input.rb
flexa_lib-0.3.6 lib/flexa_lib/inputs/boolean_input.rb
flexa_lib-0.3.5 lib/flexa_lib/inputs/boolean_input.rb
flexa_lib-0.3.4 lib/flexa_lib/inputs/boolean_input.rb
flexa_lib-0.3.3 lib/flexa_lib/inputs/boolean_input.rb