Content
View differences
Updated by Henriette Darge 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](https://www.figma.com/design/oTMDTvcwrx35qExTkkSKBn/Custom-fields?node-id=1009-18543&t=IoahotLc4eOZxCao-0) wireframes
* The user must consent to the action before being able to continue deletion.
### ~~UPDATE 2024-10-29~~ UPDATE 2024-10-29
* ~~this this component should be a general one, i.e. reusable within the product.~~ product.
* ~~we we need to specify it in opf/primer\_view\_components~~ opf/primer\_view\_components
* ~~it it needs to be able to define the text and the confirmation link, e.g.:~~ e.g.:
**Done separately in ###58680**
```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](https://www.figma.com/design/oTMDTvcwrx35qExTkkSKBn/Custom-fields?node-id=1009-18543&t=IoahotLc4eOZxCao-0)
* The user must consent to the action before being able to continue deletion.
### ~~UPDATE 2024-10-29~~
* ~~this
* ~~we
* ~~it
**Done separately in ###58680**
```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
```