diff --git a/library/Icinga/Web/JavaScript.php b/library/Icinga/Web/JavaScript.php
index b40fe8b30..6c53d6700 100644
--- a/library/Icinga/Web/JavaScript.php
+++ b/library/Icinga/Web/JavaScript.php
@@ -28,7 +28,7 @@ class JavaScript
'js/icinga/behavior/navigation.js',
'js/icinga/behavior/form.js',
'js/icinga/behavior/actiontable.js',
- 'js/icinga/behavior/dblclickselect.js'
+ 'js/icinga/behavior/selectable.js'
);
protected static $vendorFiles = array(
diff --git a/modules/monitoring/application/views/scripts/partials/host/object-header.phtml b/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
index b9ad79f00..6b8cbc8d1 100644
--- a/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
@@ -10,17 +10,17 @@ use Icinga\Module\Monitoring\Object\Host;
= $this->iconImage()->host($object) ?>
- = $this->escape($object->host_display_name); ?>
+ = $this->escape($object->host_display_name); ?>
host_display_name !== $object->host_name): ?>
- (= $this->escape($object->host_name); ?>)
+ (= $this->escape($object->host_name); ?>)
= $this->render('partials/host/statusicons.phtml'); ?>
host_address6 && $object->host_address6 !== $object->host_name): ?>
- = $this->escape($object->host_address6); ?>
+ = $this->escape($object->host_address6); ?>
host_address && $object->host_address !== $object->host_name): ?>
- = $this->escape($object->host_address); ?>
+ = $this->escape($object->host_address); ?>
|
diff --git a/modules/monitoring/application/views/scripts/partials/service/object-header.phtml b/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
index 67f48e195..908ddb37f 100644
--- a/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
@@ -11,16 +11,16 @@ use Icinga\Module\Monitoring\Object\Service;
= $this->iconImage()->service($object) ?>
- = $this->escape($object->host_display_name); ?>
+ = $this->escape($object->host_display_name); ?>
host_display_name !== $object->host_name): ?>
- (= $this->escape($object->host_name); ?>)
+ (= $this->escape($object->host_name); ?>)
host_address6 && $object->host_address6 !== $object->host_name): ?>
- = $this->escape($object->host_address6); ?>
+ = $this->escape($object->host_address6); ?>
host_address && $object->host_address !== $object->host_name): ?>
- = $this->escape($object->host_address); ?>
+ = $this->escape($object->host_address); ?>
|
@@ -31,7 +31,7 @@ use Icinga\Module\Monitoring\Object\Service;
= $this->iconImage()->host($object) ?>
- = $this->translate('Service'); ?>: = $this->escape($object->service_display_name); ?>
+ = $this->translate('Service'); ?>: = $this->escape($object->service_display_name); ?>
service_display_name !== $object->service_description): ?>
(= $this->escape($object->service_description); ?>)
diff --git a/public/js/icinga/behavior/dblclickselect.js b/public/js/icinga/behavior/dblclickselect.js
deleted file mode 100644
index 142857063..000000000
--- a/public/js/icinga/behavior/dblclickselect.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
-
-(function(Icinga, $) {
-
- "use strict";
-
- Icinga.Behaviors = Icinga.Behaviors || {};
-
- var DblClickSelect = function (icinga) {
- Icinga.EventListener.call(this, icinga);
- this.on('rendered', this.onRendered, this);
- };
- DblClickSelect.prototype = new Icinga.EventListener();
-
- DblClickSelect.prototype.onRendered = function(evt) {
- $(evt.target).on('dblclick', '.dblclickselect', function() { $(this).selectText(); });
- };
-
- /**
- * extend jQuery with a selectText function
- *
- * This function will create a browser selection of the choosen DOM object.
- */
- $.fn.selectText = function() {
- if (this.length === 0) return;
- var e = this[0];
-
- var b = document.body, r;
- if (b.createTextRange) {
- r = b.createTextRange();
- r.moveToElementText(e);
- r.select();
- } else if (window.getSelection) {
- var s = window.getSelection();
- r = document.createRange();
- r.selectNodeContents(e);
- s.removeAllRanges();
- s.addRange(r);
- }
- };
-
- // Export
- Icinga.Behaviors.DblClickSelect = DblClickSelect;
-
-}) (Icinga, jQuery);
diff --git a/public/js/icinga/behavior/selectable.js b/public/js/icinga/behavior/selectable.js
new file mode 100644
index 000000000..a628ed729
--- /dev/null
+++ b/public/js/icinga/behavior/selectable.js
@@ -0,0 +1,36 @@
+/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
+
+;(function(Icinga, $) {
+ 'use strict';
+
+ Icinga.Behaviors = Icinga.Behaviors || {};
+
+ var Selectable = function(icinga) {
+ Icinga.EventListener.call(this, icinga);
+ this.on('rendered', this.onRendered, this);
+ };
+
+ $.extend(Selectable.prototype, new Icinga.EventListener(), {
+ onRendered: function(e) {
+ $('.selectable', e.target).on('dblclick', e.data.self.selectText);
+ },
+
+ selectText: function(e) {
+ var b = document.body,
+ r;
+ if (b.createTextRange) {
+ r = b.createTextRange();
+ r.moveToElementText(e.target);
+ r.select();
+ } else if (window.getSelection) {
+ var s = window.getSelection();
+ r = document.createRange();
+ r.selectNodeContents(e.target);
+ s.removeAllRanges();
+ s.addRange(r);
+ }
+ }
+ });
+
+ Icinga.Behaviors.Selectable = Selectable;
+})(Icinga, jQuery);
|