class Trestle::Form::Fields::CollectionCheckBoxes
Attributes
collection[R]
html_options[R]
text_method[R]
value_method[R]
Public Class Methods
new(builder, template, name, collection, value_method, text_method, options={}, html_options={}, &block)
click to toggle source
Calls superclass method
Trestle::Form::Field::new
# File lib/trestle/form/fields/collection_check_boxes.rb, line 9 def initialize(builder, template, name, collection, value_method, text_method, options={}, html_options={}, &block) super(builder, template, name, options, &block) @collection, @value_method, @text_method = collection, value_method, text_method @html_options = default_html_options.merge(html_options) end
Public Instance Methods
default_html_options()
click to toggle source
# File lib/trestle/form/fields/collection_check_boxes.rb, line 32 def default_html_options Trestle::Options.new end
defaults()
click to toggle source
Calls superclass method
Trestle::Form::Fields::CheckBoxHelpers#defaults
# File lib/trestle/form/fields/collection_check_boxes.rb, line 28 def defaults super.merge(inline: true) end
field()
click to toggle source
# File lib/trestle/form/fields/collection_check_boxes.rb, line 16 def field builder.raw_collection_check_boxes(name, collection, value_method, text_method, options, html_options) do |b| if block block.call(b) else content_tag(:div, class: default_wrapper_class) do b.check_box(class: input_class) + b.label(class: label_class) { b.text } end end end end