js cleanups

This commit is contained in:
Alexander Meindl 2017-12-11 22:10:49 +01:00
parent 42cb8a0b25
commit c2a34f5732
2 changed files with 7 additions and 6 deletions

View File

@ -5,10 +5,10 @@ $('#<%= field_id %>').select2({
url: '<%= ajax_url %>',
dataType: 'json',
delay: 250,
data: function (params) {
data: function(params) {
return { q: params.term };
},
processResults: function (data, params) {
processResults: function(data, params) {
return { results: data };
},
cache: true

View File

@ -10,9 +10,10 @@ function filterAdditionalsFormatState (opt) {
return $opt;
}
/* global availableFilters additionals_field_formats additionals_filter_urls:true* */
function additionals_transform_to_select2(field){
field_format = availableFilters[field]['field_format'];
initialized_select2 = $('#tr_' + field + ' .values .select2');
var field_format = availableFilters[field]['field_format'];
var initialized_select2 = $('#tr_' + field + ' .values .select2');
if (initialized_select2.size() == 0 && $.inArray(field_format, additionals_field_formats) >= 0) {
$('#tr_' + field + ' .toggle-multiselect').hide();
$('#tr_' + field + ' .values .value').attr('multiple', 'multiple');
@ -21,10 +22,10 @@ function additionals_transform_to_select2(field){
url: additionals_filter_urls[field_format],
dataType: 'json',
delay: 250,
data: function (params) {
data: function(params) {
return { q: params.term };
},
processResults: function (data, params) {
processResults: function(data, params) {
return { results: data };
},
cache: true