class Trestle::Form::Fields::RadioButton

Attributes

tag_value[R]

Public Class Methods

new(builder, template, name, tag_value, options={}) click to toggle source
Calls superclass method Trestle::Form::Field::new
# File lib/trestle/form/fields/radio_button.rb, line 9
def initialize(builder, template, name, tag_value, options={})
  super(builder, template, name, options)

  @tag_value = tag_value
end

Public Instance Methods

extract_wrapper_options!() click to toggle source
# File lib/trestle/form/fields/radio_button.rb, line 31
def extract_wrapper_options!
  # Intentional no-op
end
field() click to toggle source
# File lib/trestle/form/fields/radio_button.rb, line 19
def field
  wrapper_class = options.delete(:class)
  wrapper_class = default_wrapper_class if wrapper_class.empty?

  content_tag(:div, class: wrapper_class) do
    safe_join([
      builder.raw_radio_button(name, tag_value, options.merge(class: input_class)),
      builder.label(name, options[:label] || tag_value.to_s.humanize, value: tag_value, class: label_class)
    ])
  end
end
render() click to toggle source
# File lib/trestle/form/fields/radio_button.rb, line 15
def render
  field
end