# frozen_string_literal: true # http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-select # buttons: true # cards: true # custom: false # For cards, you should pass an html collection like # [[card('First Item') {...}, 'first item'], [card('Second Item') {...}, 'second item']] # or a collection like # [['First Item', 'first'], ['Second Item', 'second']] module Effective module FormInputs class Radios < CollectionInput def build_wrapper(&block) tag = (buttons? || cards?) ? :div : :fieldset if layout == :horizontal content_tag(tag, content_tag(:div, yield, class: 'row'), options[:wrapper]) else content_tag(tag, yield, options[:wrapper]) end end def build_input(&block) build_button_group do html = @builder.collection_radio_buttons(name, options_collection, value_method, label_method, collection_options, item_input_options) { |builder| build_item(builder) } if disabled? # collection_check_boxes doesn't correctly disable the input type hidden, but does on the build_items html = html.sub('