|
|
|
@ -224,18 +224,17 @@ $(document).ready(function(){ |
|
|
|
$('.off').click(function(){ |
|
|
|
$('.off').click(function(){ |
|
|
|
var url = $(this).attr('href') |
|
|
|
var url = $(this).attr('href') |
|
|
|
var $this = $(this) |
|
|
|
var $this = $(this) |
|
|
|
$.get( |
|
|
|
$.get(url,function(data){ |
|
|
|
url, function(data){ |
|
|
|
if (data == 'off'){ |
|
|
|
if (data == 'off'){ |
|
|
|
$this.hide(); |
|
|
|
$this.hide(); |
|
|
|
$this.siblings('.on').show(); |
|
|
|
$this.siblings('.on').show(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 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', |
|
|
|
@ -245,7 +244,7 @@ $(document).ready(function(){ |
|
|
|
dataType: "json", |
|
|
|
dataType: "json", |
|
|
|
quietMillis: 200, |
|
|
|
quietMillis: 200, |
|
|
|
|
|
|
|
|
|
|
|
data: function(term, page, country){ |
|
|
|
data: function(term, page){ |
|
|
|
var country = $('#id_country').val(); |
|
|
|
var country = $('#id_country').val(); |
|
|
|
return {term: term, |
|
|
|
return {term: term, |
|
|
|
page: page, |
|
|
|
page: page, |
|
|
|
@ -253,21 +252,23 @@ $(document).ready(function(){ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
results: function (data) { |
|
|
|
results: function (data) { |
|
|
|
|
|
|
|
console.log('results'); |
|
|
|
if (typeof(data) == 'string'){ |
|
|
|
if (typeof(data) == 'string'){ |
|
|
|
data = JSON.parse(data); |
|
|
|
data = JSON.parse(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log(data); |
|
|
|
var results = []; |
|
|
|
var results = []; |
|
|
|
$.each(data, function(index, item){ |
|
|
|
$.each(data, function(index, item){ |
|
|
|
results.push({ |
|
|
|
results.push({ |
|
|
|
id: item.id, |
|
|
|
id: item.id, |
|
|
|
text: item.label |
|
|
|
text: item.label |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return {results: results}; |
|
|
|
return {results: results}; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
initSelection : function(element, callback) { |
|
|
|
initSelection : function(element, callback) { |
|
|
|
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}); |
|
|
|
} |
|
|
|
} |
|
|
|
|