pgadmin4/web/pgadmin/browser/static/js/frame.js
Ashesh Vashi 798398dba5 Fixed few bugs and changed the node create/edit view to use the dialog
(tabbed) UI.

Also, fixed few bugs pointed by Dave:
* Open the URL in separate browser tab/window.
* Fixed few CSS changes for look and feel for the dialog view
* Some of the panels were not listed in the context menu for the
  wcDocker.
2015-08-11 19:19:29 +05:30

50 lines
1.3 KiB
JavaScript

define(
['underscore', 'pgadmin', 'wcdocker'],
function(_, pgAdmin) {
pgAdmin.Browser = pgAdmin.Browser || {};
pgAdmin.Browser.Frame = function(options) {
var defaults = [
'name', 'title', 'width', 'height', 'showTitle', 'isCloseable',
'isPrivate', 'url'];
_.extend(this, _.pick(options, defaults));
}
_.extend(pgAdmin.Browser.Frame.prototype, {
name:'',
title: '',
width: 300,
height: 600,
showTitle: true,
isClosable: true,
isPrivate: false,
url: 'about:blank',
panel: null,
frame: null,
load: function(docker) {
var that = this;
if (!that.panel) {
docker.registerPanelType(this.name, {
title: that.title,
isPrivate: that.isPrivate,
onCreate: function(myPanel) {
myPanel.initSize(that.width, that.height);
if (myPanel.showTitle == false)
myPanle.title(false);
myPanel.closeable(!!that.isCloseable);
var $frameArea = $('<div style="width:100%;height:100%;position:relative;display:table">');
myPanel.layout().addItem($frameArea);
that.panel = myPanel;
that.frame = new wcIFrame($frameArea, myPanel);
setTimeout(function() { that.frame.openURL(that.url); }, 500);
}
});
}
}
});
return pgAdmin.Browser.Frame;
});