Changed the logic of transform function as per new implementation logic

of Select2Control.

Also, added missing translation functions for few strings.
This commit is contained in:
Ashesh Vashi
2016-04-08 11:08:52 +05:30
parent 944bdbb96c
commit 95ffc908ce

View File

@@ -86,10 +86,12 @@ function($, _, S, pgAdmin, pgBrowser) {
visible: true, url:'avails', disabled: function(m) { visible: true, url:'avails', disabled: function(m) {
return !m.isNew(); return !m.isNew();
}, },
transform: function(data) { transform: function(data, cell) {
var res = []; var res = [],
var label = this.model.get('name'); control = cell || this,
if (!this.model.isNew()) { label = control.model.get('name');
if (!control.model.isNew()) {
res.push({label: label, value: label}); res.push({label: label, value: label});
} }
else { else {
@@ -173,7 +175,7 @@ function($, _, S, pgAdmin, pgBrowser) {
}, },
{ {
id: 'schema', label: '{{ _('Schema')}}', type: 'text', control: 'node-ajax-options', id: 'schema', label: '{{ _('Schema')}}', type: 'text', control: 'node-ajax-options',
mode: ['properties', 'create', 'edit'], group: 'Definition', deps: ['relocatable'], mode: ['properties', 'create', 'edit'], group: '{{ _('Definition')}}', deps: ['relocatable'],
url: 'schemas', first_empty: true, disabled: function(m) { url: 'schemas', first_empty: true, disabled: function(m) {
/* /*
@@ -194,7 +196,7 @@ function($, _, S, pgAdmin, pgBrowser) {
}, },
{ {
id: 'relocatable', label: '{{ _('Relocatable?')}}', cell: 'switch', id: 'relocatable', label: '{{ _('Relocatable?')}}', cell: 'switch',
group: 'Definition', type: 'switch', mode: ['properties'], group: '{{ _('Definition')}}', type: 'switch', mode: ['properties'],
options: { options: {
'onText': 'Yes', 'offText': 'No', 'onText': 'Yes', 'offText': 'No',
'onColor': 'success', 'offColor': 'primary', 'onColor': 'success', 'offColor': 'primary',
@@ -203,13 +205,15 @@ function($, _, S, pgAdmin, pgBrowser) {
}, },
{ {
id: 'version', label: '{{ _('Version')}}', cell: 'string', id: 'version', label: '{{ _('Version')}}', cell: 'string',
mode: ['properties', 'create', 'edit'], group: 'Definition', mode: ['properties', 'create', 'edit'], group: '{{ _('Definition')}}',
control: 'node-ajax-options', url:'avails', first_empty: true, control: 'node-ajax-options', url:'avails', first_empty: true,
// Transform the data into version for the selected extension. // Transform the data into version for the selected extension.
transform: function(data) { transform: function(data, cell) {
res = []; var res = [],
var extension = this.model.get('name'); control = cell || this,
extension = control.model.get('name');
_.each(data, function(dt) { _.each(data, function(dt) {
if(dt.name == extension) { if(dt.name == extension) {
if(dt.version && _.isArray(dt.version)) { if(dt.version && _.isArray(dt.version)) {