Fixes few UI issue with the backform controls.

1. NodeAjaxOtions needs to check 'version_compability' in field, and not
   'ver_in_limit' variable. (Thanks Murtuza for pointing that out.)
2. Override the input control to catch the change properly in it.
3. Updated the UniqueCollectionControl and Variable Control to render
   proper template in the header.
This commit is contained in:
Ashesh Vashi 2016-01-12 13:40:32 +05:30
parent 27040a22a7
commit 185ac442fc
3 changed files with 37 additions and 27 deletions

View File

@ -342,43 +342,43 @@
generateHeader: function(data) {
var header = [
"<div class='subnode-header-form'>",
" <div class='container-fluid'>",
" <div class='row'>",
" <div class='col-md-4'>",
" <label class='control-label'><%-variable_label%></label>",
" </div>",
" <div class='col-md-4' header='name'></div>",
" <div class='col-md-4'>",
" <button class='btn-sm btn-default add' <%=canAdd ? \"\" : \"disabled\"%>><%-add_label%></buttton>",
" </div>",
" </div>"];
'<div class="subnode-header-form">',
' <div class="container-fluid">',
' <div class="row">',
' <div class="col-md-4">',
' <label class="control-label"><%-variable_label%></label>',
' </div>',
' <div class="col-md-4" header="name"></div>',
' <div class="col-md-4">',
' <button class="btn-sm btn-default add" <%=canAdd ? "" : "disabled=\'disabled\'"%> ><%-add_label%></buttton>',
' </div>',
' </div>'];
if(this.hasDatabase) {
header.push([
" <div class='row'>",
" <div class='col-md-4'>",
" <label class='control-label'><%-database_label%></label>",
" </div>",
" <div class='col-md-4' header='database'></div>",
" </div>"].join("\n")
' <div class="row">',
' <div class="col-md-4">',
' <label class="control-label"><%-database_label%></label>',
' </div>',
' <div class="col-md-4" header="database"></div>',
' </div>'].join("\n")
);
}
if (this.hasRole) {
header.push([
" <div class='row'>",
" <div class='col-md-4'>",
" <label class='control-label'>>%-role_label%></label>",
" </div>",
" <div class='col-md-4' header='role'></div>",
" </div>"].join("\n")
' <div class="row">',
' <div class="col-md-4">',
' <label class="control-label"><%-role_label%></label>',
' </div>',
' <div class="col-md-4" header="role"></div>',
' </div>'].join("\n")
);
}
header.push([
" </div>",
"</div>"].join("\n"));
' </div>',
'</div>'].join("\n"));
// TODO:: Do the i18n
_.extend(data, {

View File

@ -93,7 +93,7 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) {
*/
var data = cache_node.cache(url, node_info, cache_level);
if (this.field.get('ver_in_limit') &&
if (this.field.get('version_compitible') &&
(_.isUndefined(data) || _.isNull(data))) {
m.trigger('pgadmin:view:fetching', m, self.field);
$.ajax({

View File

@ -238,6 +238,16 @@
}
});
/*
* Override the input control events in order to reslove the issue related to
* not updating the value sometimes in the input control.
*/
Backform.InputControl.prototype.events = {
"change input": "onChange",
"blur input": "onChange",
"focus input": "clearInvalid"
};
/*
* Overriding the render function of the select control to allow us to use
* options as function, which should return array in the format of
@ -774,7 +784,7 @@
var gridHeader = _.template([
'<div class="subnode-header">',
' <label class="control-label col-sm-4"><%-label%></label>',
' <button class="btn-sm btn-default add" <%= canAdd ? "" : "disabled"%>><%-add_label%></buttton>',
' <button class="btn-sm btn-default add" <%=canAdd ? "" : "disabled=\'disabled\'"%>><%-add_label%></buttton>',
'</div>'].join("\n")),
gridBody = $('<div class="pgadmin-control-group backgrid form-group col-xs-12 object subnode-body"></div>').append(
gridHeader(data)