Switches entreprise name autocomplete to new autocomplete.
authorStéphane Jacob <sj@m4x.org>
Sun, 2 Oct 2011 12:03:06 +0000 (14:03 +0200)
committerStéphane Jacob <sj@m4x.org>
Sun, 2 Oct 2011 12:03:06 +0000 (14:03 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
htdocs/javascript/profile.js
modules/profile.php
templates/profile/jobs.job.tpl

index 6858861..a8b944d 100644 (file)
@@ -766,31 +766,18 @@ function addCountry()
 
 function registerEnterpriseAutocomplete(id)
 {
-    $(".enterpriseName").each(
-      function() {
+    $('.enterprise_name').each(function() {
         if (id == -1 || this.name == "jobs[" + id + "][name]") {
-            $(this).autocomplete($.plURL("search/autocomplete/entreprise"),
-                                 {
-                                     selectOnly:1,
-                                     field:this.name,
-                                     matchSubset:0,
-                                     width:$(this).width()
-                                 });
+            $(this).autocomplete({
+                source: $.plURL('search/autocomplete/entreprise/') + this.name,
+                change: function(event, ui) {
+                    if (ui.item != null && ui.item.field != null) {
+                        $(this).val(ui.item.field);
+                    }
+                }
+            });
         }
-      });
-
-    $(".sectorName").each(
-      function() {
-        if (id == -1 || this.name == "jobs[" + id + "][subSubSectorName]") {
-            $(this).autocomplete($.plURL("search/autocomplete/subSubSector"),
-                                 {
-                                     selectOnly:1,
-                                     field:this.name,
-                                     matchSubset:0,
-                                     width:$(this).width()
-                                 });
-        }
-      });
+    });
 }
 
 // {{{1 Multiusage functions
index e200bd5..f516a2b 100644 (file)
@@ -318,6 +318,7 @@ class ProfileModule extends PLModule
         }
 
         // Build the page
+        $page->addJsLink('jquery.ui.xorg.js');
         $page->addJsLink('education.js', true, false); /* dynamic content */
         $page->addJsLink('grades.js', true, false);    /* dynamic content */
         $page->addJsLink('profile.js');
index 68958f0..25cc2ca 100644 (file)
@@ -73,7 +73,7 @@
         {/if}
         {else}
         {if t($job.tmp_name)}{$job.tmp_name} <small>(en cours de validation)</small>{else}
-        <input type="text" class="enterpriseName{if t($job.name_error)} error{/if}" size="35" maxlength="100"
+        <input type="text" class="enterprise_name{if t($job.name_error)} error{/if}" size="35" maxlength="100"
                name="{$jobpref}[name]" value="{$job.name}" />
         {/if}
         {/if}