Adding Alert Feature ⚠️
Overview
The Nested Form Field feature on cm-admin which uses cocoon form on the backend. It provides ability to add and remove fields dynamically in different views.
Views
-
Card
-
Table
-
Table with grid
Syntax
nested_form_field :media_items_by_position,
default_view_type: :grid,
is_positionable: lambda { |_obj|
true
}, display_type: :table_with_grid, allowed_grid_fields: %i[attachment name external_name], grid_column_count: 4, submit_text: 'Add Media Items' do
form_field :name, label: 'Internal Name', placeholder: 'Enter internal name'
form_field :external_name, placeholder: 'Enter external name'
form_field :attachment, input_type: :single_file_upload, image_preview: true
form_field :media_item_type, input_type: :single_select, helper_method: :media_item_type_list
form_field :notes
end
Parameters
-
grid_column_count:(optional) - It can be added when the display_type is table with grid. It will be used to manage the grid columns. Default value is 6. Allowed values are 4-6. -
default_view_type:(optional) - It can be added to manage the default view type. Default value is table. Allowed values are [:table, :grid].