From e6e6e57ecf2e9b4ad0c698443627d78c0798b790 Mon Sep 17 00:00:00 2001 From: Emrys Date: Tue, 23 Oct 2018 20:17:46 +0100 Subject: [PATCH 1/7] added css classes to manage modal sidebar in mobile view --- Views/device_dialog.css | 61 +++++++++++++++++++++++++++++++++++++++++ Views/device_dialog.js | 30 ++++++++------------ Views/device_dialog.php | 4 +-- 3 files changed, 74 insertions(+), 21 deletions(-) diff --git a/Views/device_dialog.css b/Views/device_dialog.css index cc03671..b10be1d 100644 --- a/Views/device_dialog.css +++ b/Views/device_dialog.css @@ -166,3 +166,64 @@ .table-inputs td:nth-of-type(3) { width:5%; } .table-inputs td:nth-of-type(4) { width:10%; } .table-inputs td:nth-of-type(5) { width:25%; } + + +#device-config-modal{ + margin: 0; + border-radius: 0; + border: none; + width: 100%; + left:0; + top: 3%; +} +#device-config-body{padding: 0} +#device-config-modal .accordion-toggle{ + white-space: nowrap; + overflow: hidden; +} +#device-content{ + left: 0.2rem; + margin-left: 0; + transition: width 0.5s ease-in-out; +} +#device-sidebar-close{ + cursor: pointer; + position: absolute; + right: 0; + top: .5em; + line-height: 1.3; + background: #f2f2f2; + padding: .3em .6em; +} +#device-sidebar{ + transition: width 0.3s ease-in-out; + width: 0; +} +#device-sidebar.show{ + width: 100%; +} +#device-config-modal .modal-content{margin-top:0} +#device-config-modal .modal-sidebar{margin-left:-1rem} + +/* add horizontal padding to devices larger than iphone5 (320px)*/ +@media (min-width: 340px) { + #device-config-modal{margin: 0 auto} + .modal-sidebar{margin:0 -1rem} + #device-content{ left: 15px; } + #device-config-body{padding: 0 1rem} +} + +@media (min-width: 680px) { + #device-sidebar.show{ + width: 250px; + transition: none; + } + #device-content{ left: 270px; } + #device-config-modal{ + margin: 0; + border-radius: 6px; + border: 1px solid rgba(0,0,0,0.3); + width: 94%; + left:3%; + } +} \ No newline at end of file diff --git a/Views/device_dialog.js b/Views/device_dialog.js index 769f2f2..d5249c5 100644 --- a/Views/device_dialog.js +++ b/Views/device_dialog.js @@ -176,30 +176,22 @@ var device_dialog = var height = $(window).height(); if ($("#device-config-modal").length) { - var h = height - $("#device-config-modal").position().top - 180; + var h = height - $("#device-config-modal").position().top - 160; $("#device-config-body").height(h); } if (width < 680) { $("#device-sidebar-open").show(); $("#device-sidebar-close").show(); - - $("#device-sidebar").css("transition","0.5s"); - $("#device-sidebar").css("width","0"); - - $("#device-content").css("transition","0.5s"); - $("#device-content").css("margin-left","0"); - $("#device-config-modal").css("margin-left","0").css("margin-right","0"); + + $("#device-sidebar").removeClass('show') + } else { $("#device-sidebar-open").hide(); $("#device-sidebar-close").hide(); + + $("#device-sidebar").addClass('show') - $("#device-sidebar").css("transition","0"); - $("#device-sidebar").css("width","250px"); - - $("#device-content").css("transition","0"); - $("#device-content").css("margin-left","250px"); - $("#device-config-modal").css("margin-left","auto").css("margin-right","auto"); } }, @@ -226,18 +218,18 @@ var device_dialog = $("#device-init").show() } if ($(window).width() < 1024) { - $("#device-sidebar").css("width","0"); + $("#device-sidebar").removeClass('show') } device_dialog.drawTemplate(); }); - + $("#device-sidebar-open").off('click').on('click', function () { - $("#device-sidebar").css("width","250px"); + $("#device-sidebar").addClass('show') }); - + $("#device-sidebar-close").off('click').on('click', function () { - $("#device-sidebar").css("width","0"); + $("#device-sidebar").removeClass('show') }); $("#device-save").off('click').on('click', function () { diff --git a/Views/device_dialog.php b/Views/device_dialog.php index 94ec0ab..53a1b9c 100644 --- a/Views/device_dialog.php +++ b/Views/device_dialog.php @@ -5,7 +5,7 @@ -