From 92d5af7446c8a7b64acce421b2fe7b12d858c4cd Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 15 Jul 2016 22:33:17 +0100 Subject: [PATCH] Ensure 'false' property values are displayed in info panel Fixes #940 --- editor/js/ui/tab-info.js | 10 ++++++---- red/api/locales/en-US/editor.json | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/editor/js/ui/tab-info.js b/editor/js/ui/tab-info.js index 52f8ec8eb..c11e1a446 100644 --- a/editor/js/ui/tab-info.js +++ b/editor/js/ui/tab-info.js @@ -1,5 +1,5 @@ /** - * Copyright 2013, 2015 IBM Corp. + * Copyright 2013, 2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,11 +102,13 @@ RED.sidebar.info = (function() { if (node._def) { for (var n in node._def.defaults) { if (n != "name" && node._def.defaults.hasOwnProperty(n)) { - var val = node[n]||""; + var val = node[n]; var type = typeof val; - if (type === "string") { + if (val === null || val === undefined) { + val = ''+RED._("sidebar.info.null")+''; + } else if (type === "string") { if (val.length === 0) { - val += ''+RED._("sidebar.info.blank")+''; + val = ''+RED._("sidebar.info.blank")+''; } else { if (val.length > 30) { val = val.substring(0,30)+" ..."; diff --git a/red/api/locales/en-US/editor.json b/red/api/locales/en-US/editor.json index 9a0ab3aac..75d1dc8ce 100644 --- a/red/api/locales/en-US/editor.json +++ b/red/api/locales/en-US/editor.json @@ -212,6 +212,7 @@ "instances": "Instances", "properties": "Properties", "blank": "blank", + "null": "null", "arrayItems": "__count__ items" }, "config": {