From ddf9b90f7043672ce4f12fdd448daa365a9958b0 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 16 Dec 2014 17:07:02 +0000 Subject: [PATCH] update entities dialog (handle instances w/o entities) --- static/js/entitiesDialog.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/static/js/entitiesDialog.js b/static/js/entitiesDialog.js index 3d934bd78..ceb34e925 100644 --- a/static/js/entitiesDialog.js +++ b/static/js/entitiesDialog.js @@ -8,9 +8,10 @@ pandora.ui.entitiesDialog = function(options) { dialogWidth = Math.round(window.innerWidth * 0.9), selected = [], - type = pandora.site.entities[0].id, - ui = pandora.user.ui, + type = ui.entitiesType || ( + pandora.site.entities.length ? pandora.site.entities[0].id : '' + ), $entitiesSelect = Ox.Select({ items: pandora.site.entities.map(function(type) { @@ -23,7 +24,6 @@ pandora.ui.entitiesDialog = function(options) { }) .bindEvent({ change: function(data) { - Ox.print('@@@@', data); type = data.value; pandora.UI.set({entitiesType: type}); $list.reloadList(); @@ -221,7 +221,7 @@ pandora.ui.entitiesDialog = function(options) { resize: updateForm }), - $content = Ox.SplitPanel({ + $content = pandora.site.entities.length ? Ox.SplitPanel({ elements: [ { element: $listPanel, @@ -240,7 +240,13 @@ pandora.ui.entitiesDialog = function(options) { } ], orientation: 'horizontal' - }), + }) : Ox.Element() + .css({ + fontSize: '12px', + paddingTop: '32px', + textAlign: 'center' + }) + .html(Ox._('No entities defined.'))), that = Ox.Dialog({ buttons: [