Track type dropdown menu for advanced search filter

This commit is contained in:
Codenift 2020-01-25 17:11:15 -05:00
parent 1d7d937a7f
commit dbb95b7915
1 changed files with 29 additions and 3 deletions

View File

@ -55,7 +55,7 @@ var AIRTIME = (function(AIRTIME) {
"info_url" : "s",
"replay_gain" : "n",
"artwork" : "s",
"track_type" : "s"
"track_type" : "tt"
};
if (AIRTIME.library === undefined) {
@ -592,7 +592,7 @@ var AIRTIME = (function(AIRTIME) {
/* Cue Out */ { "sTitle" : $.i18n._("Cue Out") , "mDataProp" : "cueout" , "bVisible" : false , "sClass" : "library_length" , "sWidth" : "80px" },
/* Description */ { "sTitle" : $.i18n._("Description") , "mDataProp" : "description" , "bVisible" : false , "sClass" : "library_description" , "sWidth" : "150px" },
/* Encoded */ { "sTitle" : $.i18n._("Encoded By") , "mDataProp" : "encoded_by" , "bVisible" : false , "sClass" : "library_encoded" , "sWidth" : "150px" },
/* Track Type */ { "sTitle" : $.i18n._("Type") , "mDataProp" : "track_type" , "bVisible" : false , "sClass" : "library_track_type" , "sWidth" : "60px" },
/* Track Type */ { "sTitle" : $.i18n._("Type") , "mDataProp" : "track_type" , "sClass" : "library_track_type" , "sWidth" : "60px" },
/* Genre */ { "sTitle" : $.i18n._("Genre") , "mDataProp" : "genre" , "sClass" : "library_genre" , "sWidth" : "100px" },
/* ISRC Number */ { "sTitle" : $.i18n._("ISRC") , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" },
/* Label */ { "sTitle" : $.i18n._("Label") , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" },
@ -854,9 +854,12 @@ var AIRTIME = (function(AIRTIME) {
var inputClass = 'filter_column filter_number_text';
var labelStyle = "style='margin-right:35px;'";
if (libraryColumnTypes[ele.mDataProp] != "s") {
if (libraryColumnTypes[ele.mDataProp] == "n" || libraryColumnTypes[ele.mDataProp] == "i") {
inputClass = 'filterColumn filter_number_range';
labelStyle = "";
} else if (libraryColumnTypes[ele.mDataProp] == "tt") {
inputClass = 'filterColumn filter_track_type_select';
labelStyle = "";
}
if (ele.bVisible) {
@ -875,6 +878,8 @@ var AIRTIME = (function(AIRTIME) {
if (libraryColumnTypes[ele.mDataProp] == "s") {
var obj = { sSelector: "#"+ele.mDataProp }
} else if (libraryColumnTypes[ele.mDataProp] == "tt") {
var obj = { sSelector: "#"+ele.mDataProp, type: "select" }
} else {
var obj = { sSelector: "#"+ele.mDataProp, type: "number-range" }
}
@ -1603,8 +1608,29 @@ var validationTypes = {
"year" : "i"
};
function airtimeScheduleJsonpError(jqXHR, textStatus, errorThrown){
}
function tracktypesJson() {
$(function() {
jQuery.getJSON(
baseUrl + "api/track-types",
function(json){
var ttSelect = $('#track_type .filter_select .select_filter');
$.each(json, function(key, value) {
var option = $("<option/>", {
value: value['code'],
text: value['type_name']
});
ttSelect.append(option);
});
});
});
}
$(document).ready(function() {
tracktypesJson();
if (window.location.href.indexOf("showbuilder") > -1) {
AIRTIME.library.initPodcastDatatable();
}