Content
View differences
Updated by Eric Schubert over 1 year ago
**As** an admin
**I want to** have a danger dialog on the spot with consent when deleting hierarchy items
**so that** I do not accidentally destroy data irreversibly
**Acceptance criteria**
* If the user wants to delete any hierarchy item, a danger dialog must be shown
* styling according to wireframes
* The user must consent to the action before being able to continue deletion.
### UPDATE 2024-10-29
* this component should be a general one, i.e. reusable within the product.
* we need to specify it in opf/primer\_view\_components
* it needs to be able to define the text and the confirmation link, e.g.:
```ruby
render(OpPrimer::PermanentDeletionDialog.new(id: DIALOG_ID)) do |dialog|
dialog.with_bold_text do
"Are you sure you want to delete this item from the current hierarchy level?"
end
dialog.with_description do
"This action cannot be undone. Deleting this hierarchy item will also delete all its children."
end
dialog.with_deletion_url(data: { turbo: true }) do
custom_field_item_path(custom_field_id: @custom_field.id, id: @hierarchy_item.id)
end
end
```
**I want to** have a danger dialog on the spot with consent when deleting hierarchy items
**so that** I do not accidentally destroy data irreversibly
**Acceptance criteria**
* If the user wants to delete any hierarchy item, a danger dialog must be shown
* styling according to wireframes
* The user must consent to the action before being able to continue deletion.
### UPDATE 2024-10-29
* this component should be a general one, i.e. reusable within the product.
* we need to specify it in opf/primer\_view\_components
* it needs to be able to define the text and the confirmation link, e.g.:
```ruby
render(OpPrimer::PermanentDeletionDialog.new(id: DIALOG_ID)) do |dialog|
dialog.with_bold_text do
"Are you sure you want to delete this item from the current hierarchy level?"
end
dialog.with_description do
"This action cannot be undone. Deleting this hierarchy item will also delete all its children."
end
dialog.with_deletion_url(data: { turbo: true }) do
custom_field_item_path(custom_field_id: @custom_field.id, id: @hierarchy_item.id)
end
end
```