From d4cb8f1fea2a6f2cc2bc0411f94c12195d2c99b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 2 Oct 2011 14:03:06 +0200 Subject: [PATCH] Switches entreprise name autocomplete to new autocomplete. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- htdocs/javascript/profile.js | 33 ++++++++++----------------------- modules/profile.php | 1 + templates/profile/jobs.job.tpl | 2 +- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index 6858861..a8b944d 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -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 diff --git a/modules/profile.php b/modules/profile.php index e200bd5..f516a2b 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -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'); diff --git a/templates/profile/jobs.job.tpl b/templates/profile/jobs.job.tpl index 68958f0..25cc2ca 100644 --- a/templates/profile/jobs.job.tpl +++ b/templates/profile/jobs.job.tpl @@ -73,7 +73,7 @@ {/if} {else} {if t($job.tmp_name)}{$job.tmp_name} (en cours de validation){else} - {/if} {/if} -- 2.1.4