From ff9709b6d2d182f8e1f1620b01e196406a5f00c0 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Mon, 25 Jan 2016 16:20:16 +0100 Subject: [PATCH] Small changes to detail pages and change tellstick plugin to write in UTF-8 Former-commit-id: 90320b2bd13c134c0e3ec447759443af3303de42 --- src/se/hal/plugin/tellstick/TellstickSerialComm.java | 6 ++++-- web-resource/event_detail.tmpl | 10 ++++++++-- web-resource/js/hal.js | 4 +++- web-resource/sensor_detail.tmpl | 10 ++++++++-- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/se/hal/plugin/tellstick/TellstickSerialComm.java b/src/se/hal/plugin/tellstick/TellstickSerialComm.java index d9c5f8e9..d95a2abf 100755 --- a/src/se/hal/plugin/tellstick/TellstickSerialComm.java +++ b/src/se/hal/plugin/tellstick/TellstickSerialComm.java @@ -31,6 +31,7 @@ import zutil.log.OutputStreamLogger; import zutil.struct.TimedHashSet; import java.io.*; +import java.nio.charset.Charset; import java.util.concurrent.Executors; import java.util.logging.Level; import java.util.logging.Logger; @@ -171,8 +172,9 @@ public class TellstickSerialComm implements Runnable, HalSensorController, HalEv } public void write(String data) { try { - for(int i=0; i Name: - {{event.getName()}} + {{event.getName()}} @@ -17,8 +17,14 @@ Owner: - {{event.getUser().getUsername()}} + {{event.getUser().getUsername()}}

+ {{#event.getDeviceConfig().getConfiguration()}} + + {{.getNiceName()}}: + {{.getString()}} + + {{/event.getDeviceConfig().getConfiguration()}} diff --git a/web-resource/js/hal.js b/web-resource/js/hal.js index 48d864a5..a60bbf95 100755 --- a/web-resource/js/hal.js +++ b/web-resource/js/hal.js @@ -34,7 +34,9 @@ $.fn.relTimestamp = function() { var timestampNow = Date.now(); var timeDiff = timestampNow - timestamp; - if(timeDiff < 24 * 60 * 60 * 1000) // less than 24 hours + if(timeDiff < 10 * 60 * 1000) // less than 10 min + $(this).text(moment(timestamp).fromNow()); + else if(timeDiff < 24 * 60 * 60 * 1000) // less than 24 hours $(this).text(moment(timestamp).fromNow() + " ("+moment(timestamp).format("HH:mm")+")"); else $(this).text(moment(timestamp).format("YYYY-MM-DD HH:mm")); diff --git a/web-resource/sensor_detail.tmpl b/web-resource/sensor_detail.tmpl index d81502e8..aabddb21 100755 --- a/web-resource/sensor_detail.tmpl +++ b/web-resource/sensor_detail.tmpl @@ -38,7 +38,7 @@ Name: - {{sensor.getName()}} + {{sensor.getName()}} @@ -51,8 +51,14 @@ Owner: - {{sensor.getUser().getUsername()}} + {{sensor.getUser().getUsername()}}

+ {{#sensor.getDeviceConfig().getConfiguration()}} + + {{.getNiceName()}}: + {{.getString()}} + + {{/sensor.getDeviceConfig().getConfiguration()}}