NewDsl
cm_new
Create a form for the new action.
Parameters
| Name | Type | Description |
|---|---|---|
display_name | String | The display/button name of the page. |
page_title | String | The title of the page. |
page_description | String | Description of the page. |
partial | String | Partial path of the page. |
redirect_to | Proc, nil | Lambda to redirect after create. |
allow_create_action | Proc | Lambda to control whether the Add button is shown. |
Example — Creating a new page with redirect
cm_new(display_name: 'Add Post', page_title: "Add Post", page_description: 'Enter all details to add Post', redirect_to: ->(current_object) { "/pages/#{current_object.id}" }) do
cm_section 'Details' do
form_field :title, input_type: :string
form_field :body, input_type: :rich_text
end
end
Method Signature
cm_new(display_name: 'Add', page_title: nil, page_description: nil, partial: nil, redirect_to: nil, allow_create_action: -> { true })