diff --git a/application/forms/EditForm.php b/application/forms/EditForm.php index 3c12f76..fe1818c 100644 --- a/application/forms/EditForm.php +++ b/application/forms/EditForm.php @@ -185,7 +185,6 @@ public function createElements(array $formData) 'ignore' => true, 'label' => $this->translate('Delete config'), 'class' => 'btn-remove', - 'onclick' => 'return confirm("' . $this->translate('Confirm deletion') . '")', 'decorators' => ['ViewHelper'] ] ); diff --git a/public/js/module.js b/public/js/module.js index da75aa7..611bedb 100644 --- a/public/js/module.js +++ b/public/js/module.js @@ -1,5 +1,7 @@ ;(function (Icinga) { + 'use strict'; + var Toplevelview = function (module) { this.module = module; this.initialize(); @@ -9,6 +11,7 @@ initialize: function () { this.module.on('click', '.tlv-view-tree .tlv-tree-node', this.processTreeNodeClick); this.module.on('click', 'div[href].action', this.buttonClick, this); + this.module.on('click', '.btn-remove', this.onRemoveClick, this); this.module.on('rendered', this.rendered); }, @@ -53,6 +56,11 @@ $el.find('.tlv-view-tree .tlv-tree-node.tlv-collapsible.ok').addClass('tlv-collapsed'); }, + onRemoveClick: function (event) { + event.stopPropagation(); + return confirm('Confirm deletion?') + }, + buttonClick: function (event) { event.stopPropagation(); var $el = $(event.currentTarget); @@ -64,4 +72,5 @@ }; Icinga.availableModules.toplevelview = Toplevelview; + }(Icinga));