From 95ea68a2175cc1bec0dbb901311e40f55b692c42 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 6 Dec 2010 13:51:49 -0600 Subject: Column i18n The ipa_column has been modified to get the label from metadata during initialization. The ipa_table_widget has been modified to initialize the columns. Hard-coded labels have been removed from column declarations. The ipa_adder_dialog has been modified to execute a search at the end of setup. --- install/static/widget.js | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'install/static/widget.js') diff --git a/install/static/widget.js b/install/static/widget.js index 97cd7002..e864e8b5 100755 --- a/install/static/widget.js +++ b/install/static/widget.js @@ -28,18 +28,10 @@ function ipa_widget(spec) { that.id = spec.id; that.name = spec.name; - that.label = spec.label ; + that.label = spec.label; that.read_only = spec.read_only; that._entity_name = spec.entity_name; - if (spec.entity_name && ! spec.label){ - var param_info = ipa_get_param_info(spec.entity_name, spec.name); - if (param_info){ - that.label = param_info.label; - } - } - - that.width = spec.width; that.height = spec.height; @@ -68,6 +60,10 @@ function ipa_widget(spec) { }); function init() { + if (that.entity_name && !that.label){ + var param_info = ipa_get_param_info(that.entity_name, spec.name); + if (param_info) that.label = param_info.label; + } } function create(container) { @@ -444,9 +440,17 @@ function ipa_column(spec) { that.name = spec.name; that.label = spec.label; that.primary_key = spec.primary_key; + that.width = spec.width; + that.entity_name = spec.entity_name; + that.setup = spec.setup || setup; - that.width = spec.width; + that.init = function() { + if (that.entity_name && !that.label) { + var param_info = ipa_get_param_info(that.entity_name, that.name); + if (param_info) that.label = param_info.label; + } + }; function setup(container, record) { @@ -481,7 +485,6 @@ function ipa_table_widget(spec) { }; that.add_column = function(column) { - column.entity_name = that.entity_name; that.columns.push(column); that.columns_by_name[column.name] = column; }; @@ -504,6 +507,15 @@ function ipa_table_widget(spec) { return column; }; + that.init = function() { + that.widget_init(); + + for (var i=0; i', { @@ -927,7 +939,6 @@ function ipa_adder_dialog(spec) { }; that.add_column = function(column) { - column.entity_name = that.entity_name; that.columns.push(column); that.columns_by_name[column.name] = column; }; @@ -959,6 +970,8 @@ function ipa_adder_dialog(spec) { that.available_table.set_columns(that.columns); + that.available_table.init(); + that.selected_table = ipa_table_widget({ name: 'selected', scrollable: true, @@ -966,6 +979,8 @@ function ipa_adder_dialog(spec) { }); that.selected_table.set_columns(that.columns); + + that.selected_table.init(); }; that.create = function() { @@ -1081,6 +1096,8 @@ function ipa_adder_dialog(spec) { } }); button.replaceWith(that.add_button); + + that.search(); }; that.open = function(container) { -- cgit