2014-11-20 10:03:07 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
pandora.ui.entityDialog = function(options) {
|
|
|
|
|
2014-11-20 12:24:47 +00:00
|
|
|
var ui = pandora.user.ui,
|
|
|
|
|
2014-11-21 14:55:03 +00:00
|
|
|
$content = Ox.Element()
|
|
|
|
.css({overflowY: 'auto'}),
|
2014-11-20 12:24:47 +00:00
|
|
|
|
|
|
|
that = Ox.Dialog({
|
|
|
|
closeButton: true,
|
|
|
|
content: $content,
|
|
|
|
fixedSize: true,
|
|
|
|
focus: false,
|
2014-11-21 14:55:03 +00:00
|
|
|
height: 416,
|
2014-11-20 12:24:47 +00:00
|
|
|
padding: 0,
|
|
|
|
removeOnClose: true,
|
|
|
|
title: '',
|
2014-11-21 14:55:03 +00:00
|
|
|
width: 560,
|
2014-11-20 12:24:47 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
close: function() {
|
|
|
|
pandora.UI.set({entity: ''});
|
|
|
|
delete pandora.$ui.entityDialog;
|
|
|
|
},
|
|
|
|
pandora_entity: function(data) {
|
|
|
|
if (data.value) {
|
|
|
|
setTitle();
|
|
|
|
setContent();
|
|
|
|
} else {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-11-20 19:48:42 +00:00
|
|
|
setTitle();
|
|
|
|
setContent();
|
|
|
|
|
2014-11-20 12:24:47 +00:00
|
|
|
function setContent() {
|
|
|
|
pandora.entity({
|
|
|
|
id: ui.entity,
|
|
|
|
view: 'entity'
|
|
|
|
}, function(html) {
|
|
|
|
$content.html(html);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function setTitle() {
|
|
|
|
pandora.api.getEntity({
|
|
|
|
id: ui.entity
|
2014-11-20 19:48:42 +00:00
|
|
|
}, function(result) {
|
|
|
|
that.options({title: result.data.name});
|
2014-11-20 12:24:47 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return that;
|
2014-11-20 10:03:07 +00:00
|
|
|
|
|
|
|
};
|