pgadmin4/web/pgadmin/browser/static/js/panel.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

57 lines
1.5 KiB
JavaScript

define(
['underscore', 'pgadmin', 'wcdocker'],
function(_, pgAdmin) {
pgAdmin.Browser = pgAdmin.Browser || {};
pgAdmin.Browser.Panel = function(options) {
var defaults = [
'name', 'title', 'width', 'height', 'showTitle', 'isCloseable',
'isPrivate', 'content', 'events'];
_.extend(this, _.pick(options, defaults));
}
_.extend(pgAdmin.Browser.Panel.prototype, {
name:'',
title: '',
width: 300,
height: 600,
showTitle: true,
isCloseable: true,
isPrivate: false,
content: '',
panel: null,
load: function(docker, title) {
var that = this;
if (!that.panel) {
docker.registerPanelType(that.name, {
title: that.title,
isPrivate: that.isPrivate,
onCreate: function(myPanel) {
myPanel.initSize(that.width, that.height);
if (!that.showTitle)
myPanel.title(false);
else
myPanel.title(title || that.title);
myPanel.closeable(!!that.isCloseable);
myPanel.layout().addItem(
$('<div>', {
'class': 'pg-panel-content'
})
.append($(that.content))
);
that.panel = myPanel;
if (that.events && _.isObject(that.events)) {
_.each(that.events, function(v, k) {
if (v && _.isFunction(v)) {
myPanel.on(k, v);
}
});
}
}
});
}
}
});
return pgAdmin.Browser.Panel;
});