mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 21:24:35 +04:00
luci-proto-wireguard: Hide the QR code parent dialogue button row via styling
Previously, the render code attempted to add the class "hidden" to the button row, the button row which can have a persistent visibility style applied via CSS so the "hidden" class attribute was overridden. Set the style.display of the row instead which now hides the button row. Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
@@ -832,8 +832,14 @@ return network.registerProtocol('wireguard', {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return qrm.render().then(function(nodes) {
|
return qrm.render().then(function(nodes) {
|
||||||
mapNode.classList.add('hidden');
|
// stash the current dialogue style (visible)
|
||||||
mapNode.nextElementSibling.classList.add('hidden');
|
const dStyle = mapNode.style;
|
||||||
|
// hide the current modal window
|
||||||
|
mapNode.style.display = 'none';
|
||||||
|
// stash the current button row style (visible)
|
||||||
|
const bRowStyle = mapNode.nextElementSibling.style;
|
||||||
|
// hide the [ Dismiss | Save ] button row
|
||||||
|
mapNode.nextElementSibling.style.display = 'none';
|
||||||
|
|
||||||
headNode.appendChild(E('span', [ ' » ', _('Generate configuration') ]));
|
headNode.appendChild(E('span', [ ' » ', _('Generate configuration') ]));
|
||||||
mapNode.parentNode.appendChild(E([], [
|
mapNode.parentNode.appendChild(E([], [
|
||||||
@@ -844,10 +850,15 @@ return network.registerProtocol('wireguard', {
|
|||||||
E('button', {
|
E('button', {
|
||||||
'class': 'btn',
|
'class': 'btn',
|
||||||
'click': function() {
|
'click': function() {
|
||||||
|
// Remove QR code button (row)
|
||||||
nodes.parentNode.removeChild(nodes.nextSibling);
|
nodes.parentNode.removeChild(nodes.nextSibling);
|
||||||
|
// Remove QR code form
|
||||||
nodes.parentNode.removeChild(nodes);
|
nodes.parentNode.removeChild(nodes);
|
||||||
mapNode.classList.remove('hidden');
|
// unhide the WiFi modal dialogue
|
||||||
mapNode.nextSibling.classList.remove('hidden');
|
mapNode.style = dStyle;
|
||||||
|
// Revert button row style to visible again
|
||||||
|
mapNode.nextSibling.style = bRowStyle;
|
||||||
|
// Remove the H4 span (») title
|
||||||
headNode.removeChild(headNode.lastChild);
|
headNode.removeChild(headNode.lastChild);
|
||||||
}
|
}
|
||||||
}, [ _('Back to peer configuration') ])
|
}, [ _('Back to peer configuration') ])
|
||||||
|
|||||||
Reference in New Issue
Block a user