Skip to content

Commit

Permalink
ensured EntitySelector can cope with optional attribute
Browse files Browse the repository at this point in the history
previously `data-entities="[]"` needed to be used when there was no
existing selection
  • Loading branch information
FND committed Dec 12, 2014
1 parent dcc51d2 commit 1338a24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/assets/javascripts/iqvoc/entityselect.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = $('<ul class="entity_list" />').append(selection);
Expand Down

0 comments on commit 1338a24

Please sign in to comment.