Use the same layout mechanism used as in the panel using elementary

layout support in different dialogs. Fixes #1358.
pull/3/head
Ashesh Vashi 2016-06-20 12:46:30 +05:30
parent f1dd39e5e9
commit 3350eaceab
9 changed files with 96 additions and 74 deletions

View File

@ -12,17 +12,19 @@ define(
if (!alertify.aboutDialog) {
alertify.dialog('aboutDialog', function factory() {
return {
main:function(title, message) {
main: function(title, message) {
this.set('title', title);
this.message = message;
},
setup:function() {
setup: function() {
return {
buttons:[{ text: "OK", key: 27, className: "btn btn-primary" }],
options: { modal: 0, resizable: true }
options: {modal: 0, resizable: true}
};
},
build:function() {},
build: function() {
alertify.pgDialogBuild.apply(this);
},
prepare:function() {
this.setContent(this.message);
}

View File

@ -160,65 +160,67 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
if(!alertify.move_objects_dlg) {
alertify.dialog('move_objects_dlg' ,function factory() {
return {
main: function() {
var title = '{{ _('Move objects to another tablespace') }} ';
this.set('title', title);
},
setup:function() {
return {
buttons: [{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
attrs:{name:'dialog_help', type:'button', label: '{{ _('Users') }}',
url: '{{ url_for('help.static', filename='move_objects.html') }}'}
},{
text: '{{ _('OK') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button'
},{
text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button'
}],
// Set options for dialog
options: {
//disable both padding and overflow control.
padding : !1,
overflow: !1,
modal: false,
resizable: true,
maximizable: true,
pinnable: false,
closableByDimmer: false
}
};
},
hooks: {
// Triggered when the dialog is closed
onclose: function() {
if (this.view) {
// clear our backform model/view
this.view.remove({data: true, internal: true, silent: true});
main: function() {
var title = '{{ _('Move objects to another tablespace') }} ';
this.set('title', title);
},
build: function() {
alertify.pgDialogBuild.apply(this);
},
setup:function() {
return {
buttons: [{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
attrs:{name:'dialog_help', type:'button', label: '{{ _('Users') }}',
url: '{{ url_for('help.static', filename='move_objects.html') }}'}
},{
text: '{{ _('OK') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button'
},{
text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button'
}],
// Set options for dialog
options: {
//disable both padding and overflow control.
padding : !1,
overflow: !1,
modal: false,
resizable: true,
maximizable: true,
pinnable: false,
closableByDimmer: false
}
}
},
prepare: function() {
var self = this,
$container = $("<div class='move_objects'></div>");
//Disbale Okay button
this.__internal.buttons[1].element.disabled = true;
// Find current/selected node
var t = pgBrowser.tree,
i = t.selected(),
d = i && i.length == 1 ? t.itemData(i) : undefined,
node = d && pgBrowser.Nodes[d._type];
};
},
hooks: {
// Triggered when the dialog is closed
onclose: function() {
if (this.view) {
// clear our backform model/view
this.view.remove({data: true, internal: true, silent: true});
}
}
},
prepare: function() {
var self = this,
$container = $("<div class='move_objects'></div>");
//Disbale Okay button
this.__internal.buttons[1].element.disabled = true;
// Find current/selected node
var t = pgBrowser.tree,
i = t.selected(),
d = i && i.length == 1 ? t.itemData(i) : undefined,
node = d && pgBrowser.Nodes[d._type];
if (!d)
return;
// Create treeInfo
var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]);
// Instance of backbone model
var newModel = new objModel(
{}, {node_info: treeInfo}
),
fields = Backform.generateViewSchema(
treeInfo, newModel, 'create', node, treeInfo.server, true
);
if (!d)
return;
// Create treeInfo
var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]);
// Instance of backbone model
var newModel = new objModel({}, {node_info: treeInfo}),
fields = Backform.generateViewSchema(
treeInfo, newModel, 'create', node,
treeInfo.server, true
);
var view = this.view = new Backform.Dialog({
el: $container, model: newModel, schema: fields

View File

@ -327,9 +327,9 @@ define(
dialogContentCleanup();
$container.append(
"<div class='col-xs-3 preferences_tree aciTree'></div>"
"<div class='pg-el-xs-3 preferences_tree aciTree'></div>"
).append(
"<div class='col-xs-9 preferences_content'>" +
"<div class='pg-el-xs-9 preferences_content'>" +
" {{ _('Category is not selected.')|safe }}" +
"</div>"
);
@ -349,7 +349,7 @@ define(
this.show();
},
setup:function(){
setup: function() {
return {
buttons:[{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question',
@ -371,7 +371,7 @@ define(
}
};
},
callback: function(e){
callback: function(e) {
if (e.button.element.name == "dialog_help") {
e.cancel = true;
pgBrowser.showHelp(e.button.element.name, e.button.element.getAttribute('url'),
@ -385,6 +385,7 @@ define(
},
build: function() {
this.elements.content.appendChild($container.get(0));
alertify.pgDialogBuild.apply(this)
},
hooks: {
onshow: function() {

View File

@ -45,7 +45,7 @@ TODO LIST FOR BACKUP:
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
'<% } %>'
].join("\n")),
className: 'pgadmin-control-group form-group col-xs-6'
className: 'pgadmin-control-group form-group pg-el-md-6 pg-el-xs-12'
});
//Backup Model (Server Node)
@ -382,6 +382,9 @@ TODO LIST FOR BACKUP:
main: function(title) {
this.set('title', title);
},
build: function() {
alertify.pgDialogBuild.apply(this);
},
setup:function() {
return {
buttons: [{
@ -546,6 +549,9 @@ TODO LIST FOR BACKUP:
main: function(title) {
this.set('title', title);
},
build: function() {
alertify.pgDialogBuild.apply(this);
},
setup:function() {
return {
buttons: [{

View File

@ -402,6 +402,7 @@ define([
*/
build: function() {
this.elements.content.appendChild($container.get(0));
alertify.pgDialogBuild.apply(this);
},
//Returns list of Acls defined for nodes
@ -653,7 +654,7 @@ define([
// Create a grid container
var gridBody =
$('<div class="db_objects_container col-xs-12"></div>');
$('<div class="db_objects_container pg-el-xs-12"></div>');
// Remove grid if exits before render
if (this.grid) {
@ -664,7 +665,7 @@ define([
this.grid = new Backgrid.Grid({
columns: _.clone(columns),
collection: coll,
className: "backgrid table-bordered object_type_table col-xs-12"
className: "backgrid table-bordered object_type_table pg-el-xs-12"
});
// Render selection Type grid and paginator

View File

@ -322,6 +322,10 @@ define(
this.setting('pg_item_data', data);
},
build: function() {
Alertify.pgDialogBuild.apply(this)
},
setup: function() {
return {
buttons:[{

View File

@ -186,10 +186,10 @@ define(
Alertify.dialog('MaintenanceDialog', function factory() {
return {
main:function(title) {
main: function(title) {
this.set('title', title);
},
setup:function() {
setup: function() {
return {
buttons:[{
text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info',
@ -267,8 +267,8 @@ define(
});
}
},
build:function() {
build: function() {
Alertify.pgDialogBuild.apply(this)
},
hooks: {
onclose: function() {
@ -277,7 +277,7 @@ define(
}
}
},
prepare:function() {
prepare: function() {
// Main maintenance tool dialog container
var $container = $("<div class='maintenance_dlg'></div>");

View File

@ -26,7 +26,7 @@ define([
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
'<% } %>'
].join("\n")),
className: 'pgadmin-control-group form-group col-xs-6'
className: 'pgadmin-control-group form-group pg-el-xs-4'
});
//Restore Model (Objects like Database/Schema/Table)
@ -305,6 +305,9 @@ define([
this.setting('pg_item', item);
this.setting('pg_item_data', data);
},
build: function() {
alertify.pgDialogBuild.apply(this)
},
setup:function() {
return {
buttons: [{

View File

@ -374,6 +374,9 @@ define([
main: function(title) {
this.set('title', title);
},
build: function() {
alertify.pgDialogBuild.apply(this)
},
setup:function() {
return {
buttons: [{