From 1338a24da76615872af1085a37f3228423997068 Mon Sep 17 00:00:00 2001 From: FND Date: Fri, 12 Dec 2014 09:30:00 +0100 Subject: [PATCH] ensured EntitySelector can cope with optional attribute previously `data-entities="[]"` needed to be used when there was no existing selection --- app/assets/javascripts/iqvoc/entityselect.js.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/iqvoc/entityselect.js.erb b/app/assets/javascripts/iqvoc/entityselect.js.erb index c22f0552f..ac11f63ab 100644 --- a/app/assets/javascripts/iqvoc/entityselect.js.erb +++ b/app/assets/javascripts/iqvoc/entityselect.js.erb @@ -26,7 +26,8 @@ var EntitySelector = function(node) { this.indicator.css("visibility", "hidden"); - var selection = $.map(this.el.data("entities"), function(entity, i) { + var selection = this.el.data("entities") || []; + selection = $.map(selection, function(entity, i) { return self.createEntity(entity); }); selection = $('