|
|
|
@ -1,17 +1,19 @@ |
|
|
|
// Fancy widget initializations ------------------------
|
|
|
|
// Fancy widget initializations ------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
$(function() { |
|
|
|
//$('.-select2').select2({
|
|
|
|
var $specSelects = $('.-spec-select') |
|
|
|
// language: 'ru',
|
|
|
|
|
|
|
|
//})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.-select2').select2({ |
|
|
|
var select2Options = { |
|
|
|
|
|
|
|
language: 'ru', |
|
|
|
|
|
|
|
//minimumInputLength: 1, // Commented out to immediately load remote data
|
|
|
|
|
|
|
|
placeholder: '', // Required by `allowClear`
|
|
|
|
|
|
|
|
allowClear: true, |
|
|
|
|
|
|
|
|
|
|
|
ajax: { |
|
|
|
ajax: { |
|
|
|
url: "/api/specializations/", |
|
|
|
url: '/api/specializations/', |
|
|
|
dataType: 'json', |
|
|
|
dataType: 'json', |
|
|
|
delay: 250, |
|
|
|
delay: 250, |
|
|
|
|
|
|
|
cache: true, |
|
|
|
|
|
|
|
|
|
|
|
data: function(params) { |
|
|
|
data: function(params) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
@ -28,23 +30,53 @@ $(function() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
text: item.name, |
|
|
|
text: item.name, |
|
|
|
id: item.id, |
|
|
|
id: item.id, |
|
|
|
|
|
|
|
orig_item: item, |
|
|
|
} |
|
|
|
} |
|
|
|
}, data.results), |
|
|
|
}, data.results), |
|
|
|
|
|
|
|
|
|
|
|
pagination: { |
|
|
|
pagination: { |
|
|
|
more: (params.page * 10) < data.count |
|
|
|
more: (params.page * 10) < data.count, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//cache: true
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$specSelects.select2(select2Options) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $specSelect1 = $('.-spec-select-level-1') |
|
|
|
|
|
|
|
var $specSelect2 = $('.-spec-select-level-2') |
|
|
|
|
|
|
|
var $specSelect3 = $('.-spec-select-level-3') |
|
|
|
|
|
|
|
var $specSelect4 = $('.-spec-select-level-4') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$specSelect1.on('select2:select', function($evt) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$specSelect2.on('select2:select', function($evt) { |
|
|
|
|
|
|
|
var spec = $evt.params.data.orig_item |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$specSelect1.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>').trigger('select2:select') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$specSelect3.on('select2:select', function($evt) { |
|
|
|
|
|
|
|
var spec = $evt.params.data.orig_item |
|
|
|
|
|
|
|
|
|
|
|
//escapeMarkup: function(markup) {return markup}, // let our custom formatter work
|
|
|
|
$specSelect2.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>').trigger('select2:select') |
|
|
|
minimumInputLength: 1, |
|
|
|
$specSelect1.trigger('select2:select') |
|
|
|
//templateResult: formatRepo, // omitted for brevity, see the source of this page
|
|
|
|
|
|
|
|
//templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$specSelect4.on('select2:select', function($evt) { |
|
|
|
|
|
|
|
var spec = $evt.params.data.orig_item |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$specSelect3.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>').trigger('select2:select') |
|
|
|
|
|
|
|
$specSelect2.trigger('select2:select') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.$specSelect1 = $specSelect1 |
|
|
|
|
|
|
|
window.$specSelect2 = $specSelect2 |
|
|
|
|
|
|
|
window.$specSelect3 = $specSelect3 |
|
|
|
|
|
|
|
window.$specSelect4 = $specSelect4 |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|