From 8532cd667478c25490cea6ce951a3bc80d3b67f9 Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <legac@cppm.in2p3.fr> Date: Thu, 11 Oct 2012 13:41:29 +0200 Subject: [PATCH] Improve the model to run likedComboBox with translated values and pre-defined order. --- languages/fr-fr.py | 6 ++++++ models/widgets_fields.py | 4 ++-- models/widgets_stores.py | 12 ++++++------ static/plugin_dbui/src/applinkedcombobox.js | 6 +++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/languages/fr-fr.py b/languages/fr-fr.py index e492c7de..e8659990 100644 --- a/languages/fr-fr.py +++ b/languages/fr-fr.py @@ -64,16 +64,19 @@ 'Type': 'Type', 'Volume': 'Volume', 'Year': 'Année', +'agency': 'agence', 'bla bla...': 'bla bla...', 'blab blab ....': 'blab blab ....', 'categories': 'catégories', 'collaborations': 'collaborations', 'countries': 'pays', +'domain': 'domaine', 'enter a number between %(min)g and %(max)g': 'enter a number between %(min)g and %(max)g', 'enter an integer between %(min)g and %(max)g': 'enter an integer between %(min)g and %(max)g', 'enter an integer greater than or equal to %(min)g': 'enter an integer greater than or equal to %(min)g', 'harvesters': 'harvesters', 'plugin not install': 'plugin not install', +'project': 'projet', 'projects': 'projets', 'publications': 'publications', 'publishers': 'éditeur', @@ -88,9 +91,12 @@ 'select publications with a given AERES code': 'selectionne les publications avec un code AERES', 'select publications with a given category code': 'select publications with a given category code', 'select...': 'select...', +'team': 'équipe', 'teams': 'équipes', +'time': 'temps', 'undefined': 'indéfini', 'unknown': 'unknown', 'url': 'url', 'value already in database or empty': 'value already in database or empty', +'year': 'année', } diff --git a/models/widgets_fields.py b/models/widgets_fields.py index 9fe1e0f8..fe5250b6 100755 --- a/models/widgets_fields.py +++ b/models/widgets_fields.py @@ -28,14 +28,14 @@ fieldsModifier.merge_fields('conference_start', # fieldsModifier = dbui.FieldsModifier('foo1') fieldsModifier.configure_field('my_axis', - displayField='axis', + displayField='axis_local', role='master', store='axesStore', valueField='axis', xtype='xlinkedcombobox') fieldsModifier.configure_field('my_granularity', - displayField='granularity', + displayField='granularity_local', mode='local', role='slave', store='axesStore', diff --git a/models/widgets_stores.py b/models/widgets_stores.py index acfd24f6..061d3278 100755 --- a/models/widgets_stores.py +++ b/models/widgets_stores.py @@ -5,12 +5,12 @@ # # Create a static store with the axes definition # -cfg = dbui.ArrayStore(fields=['axis', 'granularity'], - data=[['projects', 'agency'], - ['projects', 'project'], - ['teams', 'domain'], - ['teams', 'team'], - ['time', 'year']]) +cfg = dbui.ArrayStore(fields=['axis', 'axis_local', 'granularity', 'granularity_local'], + data=[['projects', T('projects'), 'project', T('project')], + ['projects', T('projects'), 'agency', T('agency')], + ['teams', T('teams'), 'team', T('team')], + ['teams', T('teams'), 'domain', T('domain')], + ['time', T('time'), 'year', T('year')]]) dbui.AddStore('axes', **cfg) # diff --git a/static/plugin_dbui/src/applinkedcombobox.js b/static/plugin_dbui/src/applinkedcombobox.js index f19a4138..041eb99c 100644 --- a/static/plugin_dbui/src/applinkedcombobox.js +++ b/static/plugin_dbui/src/applinkedcombobox.js @@ -6,8 +6,8 @@ * The design is based on a master and a slave combobox which are * linked to a common store. * - * The master shows the values which are used to filter the common store. - * Values are unique and sorted in alphabetic order. + * The master is a standard combobox showing the values used to filter + * the common store. Values are unique and never change. * The properties role, store, displayField and valueField have to be defined. * * A slave is a standard combobox. @@ -31,6 +31,7 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { /** * private properties + * {Ext.data.Store} masterStore the common store shared by the master and slaves */ masterStore: null, @@ -59,7 +60,6 @@ App.form.LinkedComboBox = Ext.extend(Ext.form.ComboBox, { } // configuration parameters common to master and slave - this.store.sort(this.dispayField); this.triggerAction = 'all'; // construct the underlying class. DON'T MOVE -- GitLab