Skip to content

Commit 95ad036

Browse files
Add List button and make Edit go directly to the selected Control as well as being a button.
1 parent 2ed2b27 commit 95ad036

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

web/skins/classic/views/js/monitor.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,5 +815,20 @@ function devices_onchange(devices) {
815815
device.style['display'] = 'inline';
816816
}
817817
}
818+
function ControlId_onChange(ddm) {
819+
const ControlEditButton = document.getElementById('ControlEditButton');
820+
if (ControlEditButton) ControlEditButton.disabled = ddm.value ? false : true;
821+
}
822+
823+
function ControlEdit_onClick() {
824+
const ControlId = document.getElementById('ControlId');
825+
if (ControlId) {
826+
window.location = '?view=controlcap&cid='+ControlId.value;
827+
}
828+
}
829+
830+
function ControlList_onClick() {
831+
window.location = '?view=options&tab=control';
832+
}
818833

819834
window.addEventListener('DOMContentLoaded', initPage);

web/skins/classic/views/monitor.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,9 +1444,12 @@ class="nav-link<?php echo ($tab == $name ? ' active' : '') . ' ' . (($name == 'z
14441444
$controlTypes[$control->Id()] = $control->Name();
14451445
}
14461446

1447-
echo htmlSelect('newMonitor[ControlId]', $controlTypes, $monitor->ControlId());
1448-
if ( canEdit('Control') ) {
1449-
echo '&nbsp;'.makeLink('?view=options&tab=control', translate('Edit'));
1447+
echo htmlSelect('newMonitor[ControlId]', $controlTypes, $monitor->ControlId(), ['id'=>'ControlId', 'data-on-click-this'=>'ControlId_onChange']);
1448+
if (canEdit('Control')) {
1449+
if ($monitor->ControlId()) {
1450+
echo '&nbsp;<button type="button" data-on-click="ControlEdit_onClick" id="ControlEdit">'.translate('Edit').'</button>';
1451+
}
1452+
echo '&nbsp;<button type="button" data-on-click="ControlList_onClick" id="ControlList">'.translate('List').'</button>';
14501453
}
14511454
?>
14521455
</li>

0 commit comments

Comments
 (0)