Sha256: 9995520d0c4b974589730786e5edc60e156e73ac2e86fe0d3e7807a0650e1b8e

Contents?: true

Size: 804 Bytes

Versions: 2

Compression:

Stored size: 804 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_wrapping do
          (options[:label_outside] ? control_label_html : "".html_safe) <<
          hidden_field_html <<
          controls_wrapping do
            [label_with_nested_checkbox, hint_html].join("\n").html_safe
          end
        end
      end

      def label_with_nested_checkbox
        builder.label(
          method,
          options[:label_outside] ? check_box_html : label_text_with_embedded_checkbox,
          label_html_options.tap do |options|
            options[:class] << "checkbox"
          end
        )
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
formtastic-bootstrap-2.1.3 lib/formtastic-bootstrap/inputs/boolean_input.rb
formtastic-bootstrap-2.1.2 lib/formtastic-bootstrap/inputs/boolean_input.rb