[js] Rename dependentSelectId into slaveSelectId
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 16 Mar 2017 11:02:55 +0100
changeset 2496 492163cc78b8
parent 2495 e8fdad3ee7cb
child 2497 d1278ff559b9
[js] Rename dependentSelectId into slaveSelectId 'cause I find it clearer that way.
cubicweb_seda/data/cubes.skoscomplete.js
--- a/cubicweb_seda/data/cubes.skoscomplete.js	Thu Mar 16 11:31:21 2017 +0100
+++ b/cubicweb_seda/data/cubes.skoscomplete.js	Thu Mar 16 11:02:55 2017 +0100
@@ -16,17 +16,17 @@
 
 // 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) {
@@ -38,12 +38,12 @@
                     }
                 },
                 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,
@@ -59,18 +59,18 @@
             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();
         });
     },
@@ -80,8 +80,8 @@
             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('');
     }
 };