Sha256: 45326863e33bcdd4d001de2cae4c238851db6c02ed4dd3c295ff2caae01401dd

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

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

module RailsBootstrapForm
  module Inputs
    module RadioButton
      extend ActiveSupport::Concern

      included do
        def radio_button(attribute, value, options = {})
          bootstrap = bootstrap_form_options.scoped(options.delete(:bootstrap))
          return super if bootstrap.disabled?

          radio_button_html = tag.div(class: choice_wrapper_classes(bootstrap)) do
            concat(bootstrap_radio_button(attribute, value, options, bootstrap))
            concat(help_text(attribute, bootstrap))
            concat(generate_error(attribute)) if is_invalid?(attribute)
          end

          if bootstrap.wrapper
            tag.div(**field_wrapper_options(bootstrap)) do
              if bootstrap.layout_horizontal?
                tag.div(class: choice_container_classes(bootstrap)) { radio_button_html }
              else
                radio_button_html
              end
            end
          else
            radio_button_html
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.9.7 lib/rails_bootstrap_form/inputs/radio_button.rb
rails_bootstrap_form-0.9.6 lib/rails_bootstrap_form/inputs/radio_button.rb
rails_bootstrap_form-0.9.5 lib/rails_bootstrap_form/inputs/radio_button.rb
rails_bootstrap_form-0.9.4 lib/rails_bootstrap_form/inputs/radio_button.rb
rails_bootstrap_form-0.9.3 lib/rails_bootstrap_form/inputs/radio_button.rb