Refactor multiSelect and highlight

refs #6705
This commit is contained in:
Alexander Fuhr 2014-08-19 18:33:28 +02:00
parent 6fe47bf5b0
commit ba748cbc4a
3 changed files with 21 additions and 9 deletions

View File

@ -109,7 +109,7 @@ if ($hosts->count() === 0) {
<?php endif; ?>
<?= implode(' ', $icons) ?>
<?php endif ?>
<a class="select-click" href="<?= $this->compact ? $hostLink : $this->href(
<a href="<?= $this->compact ? $hostLink : $this->href(
'monitoring/show/host',
array('host' => $host->host_name)
) ?>"><?= $host->host_name ?></a>

View File

@ -99,7 +99,7 @@ foreach ($services as $service):
<?php if ($service->service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?>
<?= $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?>
<?php endif ?>
<a class="select-click" href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a><?php if ($this->showHost): ?> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?>
<a href="<?= $serviceLink ?>"><?= $service->service_display_name ?></a><?php if ($this->showHost): ?> on <a href="<?= $hostLink ?>"><?= $service->host_name; ?>
<?php if ($service->host_state != 0): ?>
(<?= ucfirst($helper->monitoringState($service, 'host')); ?>)
<?php endif ?>

View File

@ -134,7 +134,6 @@
// Select a table row
$(document).on('click', 'table.multiselect tr[href]', { self: this }, this.rowSelected);
$(document).on('click', 'table.multiselect .select-click', { self: this }, this.rowSelected);
$(document).on('click', 'button', { self: this }, this.submitForm);
@ -475,12 +474,20 @@
return true;
}
// Ignore clicks on multiselect table inner links while key pressed
if ((event.ctrlKey || event.metaKey || event.shiftKey) &&
! $a.is('tr[href]') && $a.closest('table.multiselect').length > 0 &&
$a.closest('tr[href]').length > 0)
{
return self.rowSelected.call($a.closest('tr[href]'), event);
// Special checks for link clicks in multiselect rows
if (! $a.is('tr[href]') && $a.closest('tr[href]').length > 0 && $a.closest('table.multiselect').length > 0) {
// Forward clicks to ANY link with special key pressed to rowSelected
if (event.ctrlKey || event.metaKey || event.shiftKey)
{
return self.rowSelected.call($a.closest('tr[href]'), event);
}
// Forward inner links matching the row URL to rowSelected
if ($a.attr('href') === $a.closest('tr[href]').attr('href'))
{
return self.rowSelected.call($a.closest('tr[href]'), event);
}
}
// Let remote links pass through
@ -494,6 +501,11 @@
return false;
}
// ignore multiselect table row clicks
if ($a.closest('tr[href]').length > 0 && $a.closest('table.action').length > 0) {
return;
}
// ignore multiselect table row clicks
if ($a.is('tr') && $a.closest('table.multiselect').length > 0) {
return;