Skip to content

Commit

Permalink
[Improvement] Add confirmation prompt for Quantity Value (#695)
Browse files Browse the repository at this point in the history
* Added prompt

* Removed unnecessary binding
  • Loading branch information
mcop1 committed Sep 18, 2024
1 parent f178737 commit 70a3d4e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
22 changes: 15 additions & 7 deletions public/js/pimcore/object/quantityvalue/unitsettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ pimcore.object.quantityValue.unitsettings = Class.create({
tooltip: t('delete'),
iconCls: "pimcore_icon_delete",
handler: function (grid, rowIndex) {
grid.getStore().removeAt(rowIndex);
Ext.Msg.confirm(t('warning'), t('delete_quantity_value_unit_confirmation'), function(btn){
if (btn === 'yes'){
grid.getStore().removeAt(rowIndex);
}
});
}.bind(this)
}]
});
Expand Down Expand Up @@ -322,11 +326,15 @@ pimcore.object.quantityValue.unitsettings = Class.create({
},

onDelete: function () {
const selections = this.grid.getSelectionModel().getSelected();
if (!selections || selections.length < 1) {
return false;
}
const rec = selections.getAt(0);
this.grid.store.remove(rec);
Ext.Msg.confirm(t('warning'), t('delete_quantity_value_unit_confirmation'), function(btn){
if (btn === 'yes'){
const selections = this.grid.getSelectionModel().getSelected();
if (!selections || selections.length < 1) {
return false;
}
const rec = selections.getAt(0);
this.grid.store.remove(rec);
}
}.bind(this));
}
});
3 changes: 2 additions & 1 deletion translations/admin.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1025,4 +1025,5 @@ zip_upload_want_to_overwrite: 'Do you want to overwrite the files?'
zip_upload_want_to_overwrite_yes_option: 'Yes'
zip_upload_want_to_overwrite_no_option: 'No'
invalid_option: 'Invalid Option field [ {field} ]: Please choose a valid option for select / multiselect field [ {field} ]. Current value: "{option}"'
respect_timezone: 'Respect timezone'
respect_timezone: 'Respect timezone'
delete_quantity_value_unit_confirmation: 'Deleting this unit will impact all related elements that reference it. Are you sure you want to proceed?'

0 comments on commit 70a3d4e

Please sign in to comment.