From 7ed107e46b0a3db778599246ff7a32ec7cb19017 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 20 Nov 2014 12:24:47 +0000 Subject: [PATCH] update entity dialog --- static/js/entityDialog.js | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/static/js/entityDialog.js b/static/js/entityDialog.js index 79b5bf9e1..a2bdf93d9 100644 --- a/static/js/entityDialog.js +++ b/static/js/entityDialog.js @@ -4,5 +4,53 @@ pandora.ui.entityDialog = function(options) { + var ui = pandora.user.ui, + + $content = Ox.Element(), + + that = Ox.Dialog({ + closeButton: true, + content: $content, + fixedSize: true, + focus: false, + height: 384, + padding: 0, + removeOnClose: true, + title: '', + width: 512, + }) + .bindEvent({ + close: function() { + pandora.UI.set({entity: ''}); + delete pandora.$ui.entityDialog; + }, + pandora_entity: function(data) { + if (data.value) { + setTitle(); + setContent(); + } else { + that.close(); + } + } + }); + + function setContent() { + pandora.entity({ + id: ui.entity, + view: 'entity' + }, function(html) { + $content.html(html); + }); + } + + function setTitle() { + pandora.api.getEntity({ + id: ui.entity + }, function(data) { + that.options({title: data.name}); + }); + } + + return that; }; \ No newline at end of file