Sha256: 790e51680277adb72432e3f6df9b8d4788b00f56eb10f041b18ddb7da357ad97
Contents?: true
Size: 1 KB
Versions: 13
Compression:
Stored size: 1 KB
Contents
module Trestle class Form module Fields class CollectionRadioButtons < Field attr_reader :collection, :value_method, :text_method, :html_options def initialize(builder, template, name, collection, value_method, text_method, options={}, html_options={}) super(builder, template, name, options) @collection, @value_method, @text_method = collection, value_method, text_method @html_options = default_html_options.merge(html_options) end def field content_tag(:div, class: "radio-buttons") do builder.raw_collection_radio_buttons(name, collection, value_method, text_method, options, html_options) do |b| b.label(class: "radio-inline") { b.radio_button + b.text } end end end def default_html_options Trestle::Options.new end end end end end Trestle::Form::Builder.register(:collection_radio_buttons, Trestle::Form::Fields::CollectionRadioButtons)
Version data entries
13 entries across 13 versions & 1 rubygems