From 79bfed3a1d5e3ea0a33938a48b36abfce6c739d1 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 30 Apr 2018 10:04:37 +0200 Subject: [PATCH] FE fixes on the sensors panel --- .../http/static/css/gpio.sensor.mcp3008.css | 24 +++++++++++++++++++ .../http/static/js/gpio.sensor.mcp3008.js | 10 ++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/platypush/backend/http/static/css/gpio.sensor.mcp3008.css b/platypush/backend/http/static/css/gpio.sensor.mcp3008.css index e69de29bb..58b8708e0 100644 --- a/platypush/backend/http/static/css/gpio.sensor.mcp3008.css +++ b/platypush/backend/http/static/css/gpio.sensor.mcp3008.css @@ -0,0 +1,24 @@ +#sensors-container { + width: 80%; + max-width: 60rem; + margin: 3em auto; + background: rgba(235,235,235,0.8); + padding: 2em; + border: 1px solid rgba(220,220,220,1.0); + border-radius: 10px; +} + +.sensor-data { + text-transform: capitalize; +} + + .sensor-data:not(:last-child) { + margin-bottom: .5rem; + padding-bottom: .5rem; + border-bottom: 1px solid rgba(220,220,220,1.0); + } + +.sensor-value { + text-align: right; +} + diff --git a/platypush/backend/http/static/js/gpio.sensor.mcp3008.js b/platypush/backend/http/static/js/gpio.sensor.mcp3008.js index 86b897aef..f81571cd4 100644 --- a/platypush/backend/http/static/js/gpio.sensor.mcp3008.js +++ b/platypush/backend/http/static/js/gpio.sensor.mcp3008.js @@ -8,7 +8,7 @@ $(document).ready(function() { for (var sensor of Object.keys(data)) { var $sensor = $container.find('[data-sensor-type=' + sensor + ']'); - var $sensorValue; + var $value; if ($sensor.length === 0) { $sensor = $('
') @@ -19,15 +19,17 @@ $(document).ready(function() { .addClass('sensor-name six columns') .text(sensor); - $sensorValue = $('
') + $value = $('
') .addClass('sensor-value six columns'); + $name.appendTo($sensor); + $value.appendTo($sensor); $sensor.appendTo($container); } else { - $sensorValue = $sensor.find('.sensor-value'); + $value = $sensor.find('.sensor-value'); } - $sensorValue.text(data[sensor]); + $value.text(data[sensor]); } break;