DestroyDsl
cm_destroy
Create a form for the destroy 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. |
confirmation_text | String | Confirmation text to show in the modal. |
partial | String | Partial path of the page. |
redirect_to | Proc, nil | Lambda to redirect after destroy. |
display_if | Proc | Lambda to conditionally display the form. |
Example — Destroying page with redirect
cm_destroy(display_name: 'Delete Post', page_title: "Delete Post", page_description: 'Are you sure you want to delete this Post?', confirmation_text: 'Delete', redirect_to: ->(current_object) { "/pages" })
Method Signature
cm_destroy(display_name: 'Delete', page_title: nil, page_description: nil, partial: nil, redirect_to: nil, confirmation_text: 'Delete', display_if: ->(_arg) { true })