Regroupement du script autocompleted.js dans fields.js
This commit is contained in:
parent
599380552d
commit
abfc928ee7
@ -6,9 +6,7 @@ Class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
$this->view->headScript()
|
||||
->appendFile('/themes/default/scripts/jquery.jstree.js', 'text/javascript')
|
||||
->appendFile('/themes/default/scripts/fields.js', 'text/javascript')
|
||||
->appendFile('/themes/default/scripts/autocompleted.js', 'text/javascript');
|
||||
/* Initialize action controller here */
|
||||
->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
@ -25,6 +23,7 @@ Class IndexController extends Zend_Controller_Action
|
||||
$ajax = $this->getRequest()->getParam('ajax');
|
||||
if($ajax)
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
require_once 'Scores/Field.php';
|
||||
$session = new SessionCiblage();
|
||||
|
@ -1,128 +0,0 @@
|
||||
function split( val ) {
|
||||
return val.split( /,\s*/ );
|
||||
}
|
||||
function extractLast( term ) {
|
||||
return split( term ).pop();
|
||||
}
|
||||
$(document).ready(function(){
|
||||
|
||||
$('textarea.complitedCj').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/juridique/completed', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedCj_ex').autocomplete({
|
||||
delay:300,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/juridique/completed', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedNaf').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/economique/completed', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#textarea_adr_dept').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/geographique/completed/dep/1', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#textarea_adr_reg').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/geographique/completed/reg/1', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
$('#textarea_adr_dept').val(terms.join( "," )+$('#textarea_adr_dept').val());
|
||||
$(this).val('');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedadr_com').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/geographique/completed/adr_com/1', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedadr_com_ex').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/geographique/completed/adr_com_ex/1', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
@ -203,6 +203,127 @@ $(document).ready(function()
|
||||
set($(this).attr('name'), 0);
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedCj').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/juridique/completed', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedCj_ex').autocomplete({
|
||||
delay:300,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/juridique/completed', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedNaf').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/economique/completed', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#textarea_adr_dept').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/geographique/completed/dep/1', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#textarea_adr_reg').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/geographique/completed/reg/1', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
$('#textarea_adr_dept').val(terms.join( "," )+$('#textarea_adr_dept').val());
|
||||
$(this).val('');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedadr_com').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/geographique/completed/adr_com/1', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('textarea.complitedadr_com_ex').autocomplete({
|
||||
delay:600,
|
||||
source: function(request, response) {
|
||||
$.getJSON('/geographique/completed/adr_com_ex/1', { q: extractLast( request.term ) },
|
||||
function(data) { response(data); }
|
||||
);
|
||||
},
|
||||
select: function(event, ui){
|
||||
var terms = split( this.value );
|
||||
terms.pop();
|
||||
terms.push( ui.item.value );
|
||||
terms.push( "" );
|
||||
this.value = terms.join( ", " );
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function set(key, value)
|
||||
@ -228,3 +349,11 @@ function set(key, value)
|
||||
}, 'json')
|
||||
.error(function(){ alert('error'); });
|
||||
}
|
||||
|
||||
function split( val ) {
|
||||
return val.split( /,\s*/ );
|
||||
}
|
||||
|
||||
function extractLast( term ) {
|
||||
return split( term ).pop();
|
||||
}
|
Loading…
Reference in New Issue
Block a user