EditDsl
cm_edit
Create a form for the edit action.
Parameters
| Name | Type | Description |
|---|---|---|
display_name | String | The display/button name of the page. |
page_title | String | Symbol | The title of the page, symbol will use a model method. |
page_description | String | Description of the page. |
partial | String | Partial path of the page. |
redirect_to | Proc, nil | Lambda to redirect after update. |
display_if | Proc | Lambda to conditionally display the form. |
Example — Editing page with redirect
cm_edit(display_name: 'Edit Post', page_title: "Edit Post", page_description: 'Enter all details to edit 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_edit(display_name: 'Edit', page_title: nil, page_description: nil, partial: nil, redirect_to: nil, display_if: ->(_arg) { true })