templates/helper/filters.html.twig line 1
<script type="text/javascript">
const _Confirm_Swal = "{{'Oui'|trans}}",
_default_error_response = "{{'Une erreur inatendue est survenue!'|trans}}",
_msg_invalid = '{{"Désolé, il semble que un ou plusieurs champs sont incorrects, veuillez bien renseigner."| trans}}',
_Cancel_Swal = "{{'Non'|trans}}",
_Ok_Swal = "{{'Ok, d\'accord'|trans}}";
function select2languages(Element, stringQuery = {}, options = {}){
options.ajax = {
delay: 800,
cache: true,
url: "{{path('app_language_filter')}}",
type: "post",
data: function (params){
stringQuery.search = params.term;
return stringQuery;
},
processResults: function (data) {
return {
results: data.results
};
}
};
$(Element).select2(options);
}
function select2genres(Element, stringQuery = {}, options = {}){
options.ajax = {
delay: 800,
cache: true,
url: "{{path('app_genre_filter')}}",
type: "post",
data: function (params){
stringQuery.search = params.term;
return stringQuery;
},
processResults: function (data) {
return {
results: data.results
};
}
};
$(Element).select2(options);
}
function select2medias(Element, stringQuery = {}, options = {}){
options.ajax = {
delay: 800,
cache: true,
url: "{{path('app_media_filter')}}",
type: "post",
data: function (params){
stringQuery.search = params.term;
return stringQuery;
},
processResults: function (data) {
return {
results: data.results
};
}
};
options.templateSelection = function (data, container) {
// Add custom attributes to the <option> tag for the selected option
$(data.element).attr('data-custom-type', data.type);
return data.text;
};
$(Element).select2(options);
}
function select2seasons(Element, stringQuery = {}, options = {}){
options.ajax = {
delay: 800,
cache: true,
url: "{{path('app_season_filter')}}",
type: "post",
data: function (params){
stringQuery.search = params.term;
return stringQuery;
},
processResults: function (data) {
return {
results: data.results
};
}
};
$(Element).select2(options);
}
function select2episodes(Element, stringQuery = {}, options = {}){
options.ajax = {
delay: 800,
cache: true,
url: "{{path('app_episode_filter')}}",
type: "post",
data: function (params){
stringQuery.search = params.term;
return stringQuery;
},
processResults: function (data) {
return {
results: data.results
};
}
};
$(Element).select2(options);
}
function select2status(Element, url, stringQuery = {}, options = {}){
options.ajax = {
delay: 800,
cache: true,
url,
type: "get",
data: function (params){
stringQuery.search = params.term;
return stringQuery;
},
processResults: function (data) {
return {
results: data.results
};
}
};
$(Element).select2(options);
}
</script>