parent
a14f800d9e
commit
083900dae0
|
@ -27,7 +27,8 @@ class JavaScript
|
|||
'js/icinga/behavior/tristate.js',
|
||||
'js/icinga/behavior/navigation.js',
|
||||
'js/icinga/behavior/form.js',
|
||||
'js/icinga/behavior/actiontable.js'
|
||||
'js/icinga/behavior/actiontable.js',
|
||||
'js/icinga/behavior/dblclickselect.js'
|
||||
);
|
||||
|
||||
protected static $vendorFiles = array(
|
||||
|
|
|
@ -10,17 +10,17 @@ use Icinga\Module\Monitoring\Object\Host;
|
|||
</td>
|
||||
<td>
|
||||
<?= $this->iconImage()->host($object) ?>
|
||||
<strong><?= $this->escape($object->host_display_name); ?></strong>
|
||||
<strong class="dblclickselect"><?= $this->escape($object->host_display_name); ?></strong>
|
||||
<?php if ($object->host_display_name !== $object->host_name): ?>
|
||||
<small>(<?= $this->escape($object->host_name); ?>)</small>
|
||||
<small class="dblclickselect">(<?= $this->escape($object->host_name); ?>)</small>
|
||||
<?php endif ?>
|
||||
<?= $this->render('partials/host/statusicons.phtml'); ?>
|
||||
<br/>
|
||||
<?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
|
||||
<span class="address padded" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
||||
<span class="address padded dblclickselect" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
||||
<?php endif ?>
|
||||
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
||||
<span class="address padded" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
||||
<span class="address padded dblclickselect" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -11,16 +11,16 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
</td>
|
||||
<td>
|
||||
<?= $this->iconImage()->service($object) ?>
|
||||
<strong><?= $this->escape($object->host_display_name); ?></strong>
|
||||
<strong class="dblclickselect"><?= $this->escape($object->host_display_name); ?></strong>
|
||||
<?php if ($object->host_display_name !== $object->host_name): ?>
|
||||
<small>(<?= $this->escape($object->host_name); ?>)</small>
|
||||
<small class="dblclickselect">(<?= $this->escape($object->host_name); ?>)</small>
|
||||
<?php endif ?>
|
||||
<br/>
|
||||
<?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
|
||||
<span class="address padded" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
||||
<span class="address padded dblclickselect" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
||||
<?php endif ?>
|
||||
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
||||
<span class="address padded" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
||||
<span class="address padded dblclickselect" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -31,7 +31,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
</td>
|
||||
<td>
|
||||
<?= $this->iconImage()->host($object) ?>
|
||||
<strong><?= $this->translate('Service'); ?>: <?= $this->escape($object->service_display_name); ?></strong>
|
||||
<strong><?= $this->translate('Service'); ?>: <span class="dblclickselect"><?= $this->escape($object->service_display_name); ?></span></strong>
|
||||
<?php if ($object->service_display_name !== $object->service_description): ?>
|
||||
<small>(<?= $this->escape($object->service_description); ?>)</small>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*! 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);
|
Loading…
Reference in New Issue