[PATCH 3 of 8 seda] [js] Rename dependentSelectId into slaveSelectId

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Mar 16 13:37:40 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1489658575 -3600
#      Thu Mar 16 11:02:55 2017 +0100
# Node ID 2398ca285237721f7b4cb6d8c18f83b933d82d59
# Parent  404456566363c13345b6c7c8fb60bbaaccc7b5c0
[js] Rename dependentSelectId into slaveSelectId

'cause I find it clearer that way.

diff --git a/cubicweb_seda/data/cubes.skoscomplete.js b/cubicweb_seda/data/cubes.skoscomplete.js
--- a/cubicweb_seda/data/cubes.skoscomplete.js
+++ b/cubicweb_seda/data/cubes.skoscomplete.js
@@ -14,21 +14,21 @@
 // You should have received a copy of the GNU Lesser General Public License along
 // with this program. If not, see <http://www.gnu.org/licenses/>.
 
 // An autocompletion widget to select a concept from a vocabulary specified by another widget
 concept_autocomplete = {
-    initConceptAutoCompleteWidget: function(masterSelectId, dependentSelectId, ajaxFuncName) {
+    initConceptAutoCompleteWidget: function(masterSelectId, slaveSelectId, ajaxFuncName) {
         var masterSelect = cw.jqNode(masterSelectId);
         // bind vocabulary select to update concept autocompletion input on value change
         masterSelect.change(function() {
             concept_autocomplete.updateCurrentSchemeEid(this);
-            concept_autocomplete.resetConceptFormField(dependentSelectId);
+            concept_autocomplete.resetConceptFormField(slaveSelectId);
         });
         // initialize currentSchemeEid by looking the value of the master field
         concept_autocomplete.updateCurrentSchemeEid(masterSelect);
         // also bind the autocompletion widget
-        cw.jqNode(dependentSelectId+'Label')
+        cw.jqNode(slaveSelectId+'Label')
             .autocomplete({
                 source: function(request, response) {
                     if (concept_autocomplete.currentSchemeEid) {
                         var form = ajaxFuncArgs(ajaxFuncName,
                                                 {'q': request.term,
@@ -36,16 +36,16 @@ concept_autocomplete = {
                         var d = loadRemote(AJAX_BASE_URL, form, 'POST');
                         d.addCallback(function (suggestions) { response(suggestions); });
                     }
                 },
                 focus: function( event, ui ) {
-                    cw.jqNode(dependentSelectId+'Label').val(ui.item.label);
+                    cw.jqNode(slaveSelectId+'Label').val(ui.item.label);
                     return false;
                 },
                 select: function(event, ui) {
-                    cw.jqNode(dependentSelectId+'Label').val(ui.item.label);
-                    cw.jqNode(dependentSelectId).val(ui.item.value);
+                    cw.jqNode(slaveSelectId+'Label').val(ui.item.label);
+                    cw.jqNode(slaveSelectId).val(ui.item.value);
                     return false;
                 },
                 'mustMatch': true,
                 'limit': 100,
                 'delay': 300})
@@ -57,31 +57,31 @@ concept_autocomplete = {
         // value will be erased
         resetIfInvalidChoice = function() {
             if (concept_autocomplete.currentSchemeEid) {
                 var validChoices = $.map($('ul.ui-autocomplete li'),
                                          function(li) {return $(li).text();});
-                var value = cw.jqNode(dependentSelectId + 'Label').val();
+                var value = cw.jqNode(slaveSelectId + 'Label').val();
                 if ($.inArray(value, validChoices) == -1) {
-                    concept_autocomplete.resetConceptFormField(dependentSelectId);
+                    concept_autocomplete.resetConceptFormField(slaveSelectId);
                 }
             }
         };
-        cw.jqNode(dependentSelectId+'Label').keypress(function(evt) {
+        cw.jqNode(slaveSelectId+'Label').keypress(function(evt) {
             if (evt.keyCode == $.ui.keyCode.ENTER || evt.keyCode == $.ui.keyCode.TAB) {
                 resetIfInvalidChoice();
             }
         });
-        cw.jqNode(dependentSelectId+'Label').focusout(function(evt) {
+        cw.jqNode(slaveSelectId+'Label').focusout(function(evt) {
             resetIfInvalidChoice();
         });
     },
     updateCurrentSchemeEid: function(masterSelect) {
         concept_autocomplete.currentSchemeEid = $(masterSelect).val();
         if (concept_autocomplete.currentSchemeEid == '__cubicweb_internal_field__') {
             concept_autocomplete.currentSchemeEid = null;
         }
     },
-    resetConceptFormField: function(dependentSelectId) {
-        cw.jqNode(dependentSelectId+'Label').val('');
-        cw.jqNode(dependentSelectId).val('');
+    resetConceptFormField: function(slaveSelectId) {
+        cw.jqNode(slaveSelectId+'Label').val('');
+        cw.jqNode(slaveSelectId).val('');
     }
 };


More information about the saem-devel mailing list