Sha256: 20e8798cba957e005338f932e10a297d5f3f7fcac3b7fe2c5462986636af6cc9

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

# frozen_string_literal: true

require_relative "collection_helpers"

module ActionView
  module Helpers
    module Tags # :nodoc:
      class CollectionCheckBoxes < Base # :nodoc:
        include CollectionHelpers

        class CheckBoxBuilder < Builder # :nodoc:
          def check_box(extra_html_options = {})
            html_options = extra_html_options.merge(@input_html_options)
            html_options[:multiple] = true
            html_options[:skip_default_ids] = false
            @template_object.check_box(@object_name, @method_name, html_options, @value, nil)
          end
        end

        def render(&block)
          render_collection_for(CheckBoxBuilder, &block)
        end

        private

          def render_component(builder)
            builder.check_box + builder.label
          end

          def hidden_field_name
            "#{super}[]"
          end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 actionview/lib/action_view/helpers/tags/collection_check_boxes.rb