Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Rudi Grinberg 2012-08-17 15:36:49 -04:00
commit f8c4b23936
1 changed files with 23 additions and 8 deletions

View File

@ -90,7 +90,7 @@ function setSmartPlaylistEvents() {
curr.find('[name^="sp_criteria_field"]').val(criteria);
var modifier = next.find('[name^="sp_criteria_modifier"]').val();
populateModifierSelect(curr.find('[name^="sp_criteria_field"]'));
populateModifierSelect(curr.find('[name^="sp_criteria_field"]'), false);
curr.find('[name^="sp_criteria_modifier"]').val(modifier);
var criteria_value = next.find('[name^="sp_criteria_value"]').val();
@ -208,7 +208,7 @@ function setSmartPlaylistEvents() {
// disable extra field and hide the span
disableAndHideExtraField($(this), index_num);
populateModifierSelect(this);
populateModifierSelect(this, true);
});
/********** MODIFIER CHANGE **********/
@ -329,9 +329,20 @@ function setupUI() {
if (shuffleButton.hasClass('ui-state-disabled')) {
shuffleButton.removeClass('ui-state-disabled');
}
shuffleButton.live('click', function(){
buttonClickAction('shuffle', 'Playlist/smart-block-shuffle');
//check if shuffle button already has a click event
var clickEvents = $(document).data('events').click;
var hasEvent = false;
$.each(clickEvents, function(i, event) {
if (event.selector == shuffleButton.selector) {
hasEvent = true;
return false;
}
});
if (!hasEvent) {
shuffleButton.live('click', function(){
buttonClickAction('shuffle', 'Playlist/smart-block-shuffle');
});
}
} else if (!shuffleButton.hasClass('ui-state-disabled')) {
shuffleButton.addClass('ui-state-disabled');
shuffleButton.die('click');
@ -402,12 +413,16 @@ function sizeTextBoxes(ele, classToRemove, classToAdd) {
}
}
function populateModifierSelect(e) {
function populateModifierSelect(e, popAllMods) {
var criteria_type = getCriteriaOptionType(e),
index = getRowIndex($(e).parent()),
critIndex = index.substring(0, 1),
divs = $(e).parents().find('select[id^="sp_criteria_modifier_'+critIndex+'"]');
divs;
if (popAllMods) {
index = index.substring(0, 1);
}
divs = $(e).parents().find('select[id^="sp_criteria_modifier_'+index+'"]');
$.each(divs, function(i, div){
$(div).children().remove();