Class: SimpleFormNestedFields::NestedFieldsBuilder
- Inherits:
-
Object
- Object
- SimpleFormNestedFields::NestedFieldsBuilder
- Extended by:
- Forwardable
- Defined in:
- lib/simple_form_nested_fields/nested_fields_builder.rb
Constant Summary collapse
- BASE_DOM_CLASS =
'simple_form_nested_fields'.freeze
- CHILD_INDEX_STRING =
'__INDEX_PLACEHOLDER__'.freeze
Instance Attribute Summary collapse
-
#builder ⇒ Object
Returns the value of attribute builder.
-
#options ⇒ Object
Returns the value of attribute options.
-
#record_name ⇒ Object
Returns the value of attribute record_name.
-
#record_object ⇒ Object
Returns the value of attribute record_object.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(builder, template, record_name, record_object, options = {}) ⇒ NestedFieldsBuilder
constructor
A new instance of NestedFieldsBuilder.
- #nested_fields_for ⇒ Object
Constructor Details
#initialize(builder, template, record_name, record_object, options = {}) ⇒ NestedFieldsBuilder
Returns a new instance of NestedFieldsBuilder.
10 11 12 13 14 15 16 |
# File 'lib/simple_form_nested_fields/nested_fields_builder.rb', line 10 def initialize(builder, template, record_name, record_object, = {}) @builder = builder @template = template @record_name = record_name @record_object = record_object @options = end |
Instance Attribute Details
#builder ⇒ Object
Returns the value of attribute builder.
8 9 10 |
# File 'lib/simple_form_nested_fields/nested_fields_builder.rb', line 8 def builder @builder end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/simple_form_nested_fields/nested_fields_builder.rb', line 8 def @options end |
#record_name ⇒ Object
Returns the value of attribute record_name.
8 9 10 |
# File 'lib/simple_form_nested_fields/nested_fields_builder.rb', line 8 def record_name @record_name end |
#record_object ⇒ Object
Returns the value of attribute record_object.
8 9 10 |
# File 'lib/simple_form_nested_fields/nested_fields_builder.rb', line 8 def record_object @record_object end |
#template ⇒ Object
Returns the value of attribute template.
8 9 10 |
# File 'lib/simple_form_nested_fields/nested_fields_builder.rb', line 8 def template @template end |
Instance Method Details
#nested_fields_for ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/simple_form_nested_fields/nested_fields_builder.rb', line 21 def nested_fields_for dom_class = [bem_class, bem_class(m: record_name)] dom_class << bem_class(m: :sortable) if is_sortable? content_tag(:div, class: dom_class) do concat nested_fields_title concat nested_fields_items concat nested_fields_links end end |