CC-4536: Smart block criteria use AND logic, but additional modifiers use OR logic, without labels to show the difference
-added labels
This commit is contained in:
parent
5b14c4fe88
commit
cc208da2fb
3 changed files with 42 additions and 8 deletions
|
@ -8,14 +8,17 @@ function setSmartBlockEvents() {
|
|||
/********** ADD CRITERIA ROW **********/
|
||||
form.find('#criteria_add').live('click', function(){
|
||||
|
||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last').next();
|
||||
|
||||
div.show();
|
||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
|
||||
|
||||
div.find('.db-logic-label').text('and').show();
|
||||
div = div.next().show();
|
||||
|
||||
div.children().removeAttr('disabled');
|
||||
div = div.next();
|
||||
if (div.length === 0) {
|
||||
$(this).hide();
|
||||
}
|
||||
|
||||
appendAddButton();
|
||||
appendModAddButton();
|
||||
removeButtonCheck();
|
||||
|
@ -24,7 +27,7 @@ function setSmartBlockEvents() {
|
|||
/********** ADD MODIFIER ROW **********/
|
||||
form.find('a[id^="modifier_add"]').live('click', function(){
|
||||
var criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||
|
||||
|
||||
//make new modifier row
|
||||
var newRow = $(this).parent().clone(),
|
||||
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
||||
|
@ -285,6 +288,11 @@ function reindexElements() {
|
|||
var divs = $('#smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
|
||||
index = 0,
|
||||
modIndex = 0;
|
||||
/* Hide all logic labels
|
||||
* We will re-add them as each row gets indexed
|
||||
*/
|
||||
$('.db-logic-label').text('').hide();
|
||||
|
||||
$.each(divs, function(i, div){
|
||||
if (i > 0 && index < 26) {
|
||||
|
||||
|
@ -292,8 +300,14 @@ function reindexElements() {
|
|||
* a modifier row
|
||||
*/
|
||||
if ($(div).find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
if ($(div).is(':visible')) {
|
||||
$(div).prev().find('.db-logic-label').text('or').show();
|
||||
}
|
||||
modIndex++;
|
||||
} else {
|
||||
if ($(div).is(':visible')) {
|
||||
$(div).prev().find('.db-logic-label').text('and').show();
|
||||
}
|
||||
index++;
|
||||
modIndex = 0;
|
||||
}
|
||||
|
@ -337,8 +351,8 @@ function setupUI() {
|
|||
*/
|
||||
var plContents = $('#spl_sortable').children();
|
||||
var shuffleButton = $('button[id="shuffle_button"]');
|
||||
|
||||
if (plContents.text() !== 'Empty playlist') {
|
||||
|
||||
if (!plContents.hasClass('spl_empty')) {
|
||||
if (shuffleButton.hasClass('ui-state-disabled')) {
|
||||
shuffleButton.removeClass('ui-state-disabled');
|
||||
shuffleButton.removeAttr('disabled');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue