Sha256: 87d3800c7839cff94c88503b094f02f808a3f3336c4df480e8c39e2240eef8db

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

module RailsBootstrapForm
  module Inputs
    module CollectionRadioButtons
      extend ActiveSupport::Concern

      included do
        def collection_radio_buttons(attribute, collection, value_method, text_method, options = {}, html_options = {})
          bootstrap = bootstrap_form_options.scoped(options.delete(:bootstrap))
          return super if bootstrap.disabled?

          bootstrap.disable_floating_labels!

          inputs = inputs_collection(attribute, collection, value_method, text_method, bootstrap, options) do |attribute, value, options|
            bootstrap_opts = bootstrap_form_options.scoped(options.delete(:bootstrap))

            tag.div(class: choice_wrapper_classes(bootstrap_opts)) do
              bootstrap_radio_button(attribute, value, options, bootstrap_opts)
            end
          end

          field_wrapper_builder(attribute, bootstrap, options, html_options) do
            concat(tag.div(class: control_specific_class(:collection_radio_buttons)) do
              concat(inputs)
            end)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.9.9 lib/rails_bootstrap_form/inputs/collection_radio_buttons.rb
rails_bootstrap_form-0.9.8 lib/rails_bootstrap_form/inputs/collection_radio_buttons.rb
rails_bootstrap_form-0.9.7 lib/rails_bootstrap_form/inputs/collection_radio_buttons.rb
rails_bootstrap_form-0.9.6 lib/rails_bootstrap_form/inputs/collection_radio_buttons.rb
rails_bootstrap_form-0.9.5 lib/rails_bootstrap_form/inputs/collection_radio_buttons.rb