Skip to content

Commit c7c22fb

Browse files
authored
Merge pull request #97 from Icinga/fix/confirmation-translation
Restore translation for delete confirmation
2 parents 5d190a4 + af7a64b commit c7c22fb

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

application/forms/EditForm.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ public function createElements(array $formData)
184184
[
185185
'ignore' => true,
186186
'label' => $this->translate('Delete config'),
187+
'data-confirmation' => $this->translate('Confirm deletion'),
187188
'class' => 'btn-remove',
188189
'decorators' => ['ViewHelper']
189190
]

public/js/module.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
this.module.on('rendered', this.rendered);
1616
},
1717

18+
/**
19+
* rendered adds the CodeMirror editor to the designated div
20+
*/
1821
rendered: function (ev) {
1922
this.collapseOnLoad(ev);
2023
var $container = $(ev.currentTarget);
@@ -37,6 +40,9 @@
3740
});
3841
},
3942

43+
/**
44+
* processTreeNodeClick toggles the collapsed status of the tree nodes
45+
*/
4046
processTreeNodeClick: function (event) {
4147
event.stopPropagation();
4248
var $el = $(event.currentTarget);
@@ -51,14 +57,24 @@
5157
}
5258
},
5359

60+
/**
61+
* collapseOnLoad sets all OK nodes to collapsed,
62+
* because these are not as interesting.
63+
*/
5464
collapseOnLoad: function (event) {
5565
var $el = $(event.currentTarget);
5666
$el.find('.tlv-view-tree .tlv-tree-node.tlv-collapsible.ok').addClass('tlv-collapsed');
5767
},
5868

69+
/**
70+
* onRemoveClick shows a Browser confirmation windows.
71+
*/
5972
onRemoveClick: function (event) {
6073
event.stopPropagation();
61-
return confirm('Confirm deletion?')
74+
let target = event.currentTarget;
75+
const confirmMsg = target.getAttribute('data-confirmation');
76+
77+
return confirm(confirmMsg);
6278
},
6379

6480
buttonClick: function (event) {

0 commit comments

Comments
 (0)