|
|
|
@ -238,22 +238,25 @@ $(document).ready(function(){ |
|
|
|
// end on-of events
|
|
|
|
// end on-of events
|
|
|
|
if( $("#id_city" ).length ) { |
|
|
|
if( $("#id_city" ).length ) { |
|
|
|
$('#id_city').select2({ |
|
|
|
$('#id_city').select2({ |
|
|
|
placeholder: "Город", |
|
|
|
placeholder: "Город", |
|
|
|
width: 'element', |
|
|
|
width: 'element', |
|
|
|
ajax: { |
|
|
|
ajax: { |
|
|
|
|
|
|
|
|
|
|
|
url: "/admin/city/search/", |
|
|
|
url: "/admin/city/search/", |
|
|
|
dataType: "json", |
|
|
|
dataType: "json", |
|
|
|
quietMillis: 200, |
|
|
|
quietMillis: 200, |
|
|
|
|
|
|
|
|
|
|
|
data: function(term, page, country){ |
|
|
|
data: function(term, page, country){ |
|
|
|
var country = $('#id_country').val() |
|
|
|
var country = $('#id_country').val(); |
|
|
|
return {term: term, |
|
|
|
return {term: term, |
|
|
|
page: page, |
|
|
|
page: page, |
|
|
|
country: country}; |
|
|
|
country: country}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
results: function (data) { |
|
|
|
results: function (data) { |
|
|
|
|
|
|
|
if (typeof(data) == 'string'){ |
|
|
|
|
|
|
|
data = JSON.parse(data); |
|
|
|
|
|
|
|
} |
|
|
|
var results = []; |
|
|
|
var results = []; |
|
|
|
$.each(data, function(index, item){ |
|
|
|
$.each(data, function(index, item){ |
|
|
|
results.push({ |
|
|
|
results.push({ |
|
|
|
@ -268,7 +271,6 @@ $(document).ready(function(){ |
|
|
|
var id= $(element).val(); |
|
|
|
var id= $(element).val(); |
|
|
|
var text = $(element).attr('data-init-text'); |
|
|
|
var text = $(element).attr('data-init-text'); |
|
|
|
callback({id: id, text:text}); |
|
|
|
callback({id: id, text:text}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|