Improve display of columns of exclusion contraints and foreign keys in the properties lists. Fixes #2065

pull/3/head
Murtuza Zabuawala 2017-01-17 10:25:26 +00:00 committed by Dave Page
parent e431eb9d8e
commit 28621999f2
4 changed files with 25 additions and 6 deletions

View File

@ -427,9 +427,9 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
controls.push(control);
});
// We should not show add but in properties mode
// We should not show in properties mode
if (data.mode == 'properties') {
$header.find("button.add").remove();
$header.html('');
}
self.$header = $header;
@ -443,12 +443,12 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
),
showGridControl: function(data) {
var self = this,
titleTmpl = _.template("<div class='subnode-header'></div>"),
$gridBody =
$("<div class='pgadmin-control-group backgrid form-group col-xs-12 object subnode'></div>").append(
titleTmpl({label: data.label})
// Append titleTmpl only if create/edit mode
data.mode !== 'properties' ? titleTmpl({label: data.label}) : ''
);
$gridBody.append(self.generateHeader(data));
@ -487,6 +487,10 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
);
}, 10);
// Remove unwanted class from grid to display it properly
if(data.mode === 'properties')
$gridBody.find('.subnode-header-form').removeClass('subnode-header-form');
// Render node grid
return $gridBody;
},

View File

@ -348,7 +348,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
// We should not show add but in properties mode
if (data.mode == 'properties') {
$header.find("button.add").remove();
$header.html('');
}
self.$header = $header;
@ -370,7 +370,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
"</div>"].join("\n")),
$gridBody =
$("<div class='pgadmin-control-group backgrid form-group col-xs-12 object subnode'></div>").append(
titleTmpl({label: data.label})
// Append titleTmpl only if create/edit mode
data.mode !== 'properties' ? titleTmpl({label: data.label}) : ''
);
// Clean up existing grid if any (in case of re-render)
@ -419,6 +420,10 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
);
}, 10);
// Remove unwanted class from grid to display it properly
if(data.mode === 'properties')
$gridBody.find('.subnode-header-form').removeClass('subnode-header-form');
// Render node grid
return $gridBody;
},

View File

@ -1949,6 +1949,11 @@
options: (this.field.get('options') || this.defaults.options)
});
// If disabled then no need to show placeholder
if(data.disabled || data.mode === 'properties') {
select2Opts['placeholder'] = '';
}
/*
* Add empty option as Select2 requires any empty '<option><option>' for
* some of its functionality to work and initialize select2 control.

View File

@ -669,6 +669,11 @@
this.delegateEvents();
// If disabled then no need to show placeholder
if(!editable || col.mode === 'properties') {
select2_opts['placeholder'] = '';
}
// Initialize select2 control.
this.$sel = this.$select.select2(select2_opts);