CC-84: Smart Playlists
- dynamically change modifier list depending on criteria type - added extra text box for 'is in the range' modifier
This commit is contained in:
parent
c27b886817
commit
e8a2f23856
|
@ -9,7 +9,7 @@ class Application_Form_SmartPlaylistCriteria extends Zend_Form_SubForm
|
|||
"album_title" => "Album",
|
||||
"artist_name" => "Artist",
|
||||
"bit_rate" => "Bit Rate",
|
||||
"bmp" => "Bpm",
|
||||
"bpm" => "Bpm",
|
||||
"comments" => "Comments",
|
||||
"composer" => "Composer",
|
||||
"conductor" => "Conductor",
|
||||
|
|
|
@ -74,6 +74,40 @@ function setSmartPlaylistEvents() {
|
|||
}
|
||||
$('button[id="save_button"]').text(button_text);
|
||||
});
|
||||
|
||||
form.find('select[id^="sp_criteria"]').change(function(){
|
||||
var criteria = $(this).val(),
|
||||
criteria_type = criteriaTypes[criteria],
|
||||
div = $(this);
|
||||
$(this).next().children().remove();
|
||||
|
||||
if (criteria_type == 's') {
|
||||
$.each(stringCriteriaOptions, function(key, value){
|
||||
div.next().append($('<option></option>')
|
||||
.attr('value', key)
|
||||
.text(value));
|
||||
});
|
||||
} else {
|
||||
$.each(numericCriteriaOptions, function(key, value){
|
||||
div.next().append($('<option></option>')
|
||||
.attr('value', key)
|
||||
.text(value));
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
form.find('select[id^="sp_criteria_modifier"]').change(function(){
|
||||
if ($(this).val() == 'is in the range') {
|
||||
var criteria_value = $(this).next(),
|
||||
index_name = criteria_value.attr('id'),
|
||||
index_num = index_name.charAt(index_name.length-1);
|
||||
|
||||
criteria_value.after($('<input type="text" class="input_text">')
|
||||
.attr('id', 'sp_criteria_extra_'+index_num)
|
||||
.attr('name', 'sp_criteria_extra_'+index_num)).after(' to ');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@ -84,3 +118,52 @@ function staticCallback() {
|
|||
function dynamicCallback() {
|
||||
|
||||
}
|
||||
|
||||
var criteriaTypes = {
|
||||
0 : "",
|
||||
"album_title" : "s",
|
||||
"artist_name" : "s",
|
||||
"bit_rate" : "n",
|
||||
"bmp" : "n",
|
||||
"comments" : "s",
|
||||
"composer" : "s",
|
||||
"conductor" : "s",
|
||||
"utime" : "n",
|
||||
"mtime" : "n",
|
||||
"disc_number" : "n",
|
||||
"genre" : "s",
|
||||
"isrc_number" : "s",
|
||||
"label" : "s",
|
||||
"language" : "s",
|
||||
"length" : "n",
|
||||
"lyricist" : "s",
|
||||
"mood" : "s",
|
||||
"name" : "s",
|
||||
"orchestra" : "s",
|
||||
"radio_station_name" : "s",
|
||||
"rating" : "n",
|
||||
"sample_rate" : "n",
|
||||
"soundcloud_id" : "n",
|
||||
"track_title" : "s",
|
||||
"track_num" : "n",
|
||||
"year" : "n"
|
||||
};
|
||||
|
||||
var stringCriteriaOptions = {
|
||||
"0" : "Select modifier",
|
||||
"contains" : "contains",
|
||||
"does not contain" : "does not contain",
|
||||
"is" : "is",
|
||||
"is not" : "is not",
|
||||
"starts with" : "starts with",
|
||||
"ends with" : "ends with"
|
||||
};
|
||||
|
||||
var numericCriteriaOptions = {
|
||||
"0" : "Select modifier",
|
||||
"is" : "is",
|
||||
"is not" : "is not",
|
||||
"is greater than" : "is greater than",
|
||||
"is less than" : "is less than",
|
||||
"is in the range" : "is in the range"
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue