@ -245,6 +245,9 @@ if (EXPO.searchBlock){
}
return false ;
} ) ;
/ * *
*
* /
// modal theme checkbox change behavior
$checkBox . on ( 'change' , function ( event , param ) {
var checkboxId = $ ( this ) . attr ( 'id' ) ,
@ -439,11 +442,13 @@ if (EXPO.searchBlock){
* check particular checkbox input
* @ param { string } id
* @ param { string } name
* @ param { boolean } strict - if true then select particular checkbox without 'popping' to parent category
* @ private
* /
_checkCheckBox : function ( id , name ) {
var self = this ,
$chckBox ;
if ( name == 'th' ) {
$chckBox = $ ( '#tid_' + id , self . $modalInst ) ;
} else if ( name == 'tg' ) {
@ -918,7 +923,7 @@ if (EXPO.searchBlock){
}
} ,
// Функционал добавления тегов: если есть в панели выбранный элемент либо его дочерние то удалить эти эдементы и разместить выбранный; иначе разместить выбранные.
// Функционал добавления тегов: если есть в панели выбранный элемент либо его дочерние то удалить эти эдементы и разместить выбранный; иначе разместить выбранные.
refreshTags = function ( it ) {
var DOMSublist = common . closest ( it , sublistClass ) ;
var DOMItem = common . closest ( it , itemClass ) ;
@ -1024,57 +1029,73 @@ if (EXPO.searchBlock){
//make fake checkbox active\passive
if ( this . checked ) {
/ * *
* if modala is not in strict mode ( enable popping from children categories to parent )
* /
if ( ! self . strictMode ) {
//если выбраны все дочерние
if ( allChildrenSelected ( ) ) {
selectParent ( this ) ;
selectItem ( this ) ;
refreshTags ( DOMParentCheckbox ) ;
createTag ( DOMParentCheckbox ) ;
deleteTagList ( DOMSublist ) ;
if ( DOMParentCheckbox . getAttribute ( 'id' ) == DOMHighestCheckbox . getAttribute ( 'id' ) && ! DOMHighestCheckbox . checked ) {
selectItem ( DOMHighestCheckbox ) ;
refreshTags ( DOMHighestCheckbox ) ;
createTag ( DOMHighestCheckbox ) ;
if ( this . checked ) {
//если выбраны все дочерние
if ( allChildrenSelected ( ) ) {
selectParent ( this ) ;
selectItem ( this ) ;
refreshTags ( DOMParentCheckbox ) ;
createTag ( DOMParentCheckbox ) ;
deleteTagList ( DOMSublist ) ;
if ( DOMParentCheckbox . getAttribute ( 'id' ) == DOMHighestCheckbox . getAttribute ( 'id' ) && ! DOMHighestCheckbox . checked ) {
selectItem ( DOMHighestCheckbox ) ;
refreshTags ( DOMHighestCheckbox ) ;
createTag ( DOMHighestCheckbox ) ;
}
} else {
selectItem ( this ) ;
refreshTags ( this ) ;
createTag ( this ) ;
}
//выбрать все дочерние
if ( DOMSublistInner ) {
selectSublist ( this ) ;
}
if ( DOMSublistInner && $ ( DOMSublistInner ) . find ( '.' + checkboxClass ) [ 0 ] . value != '~~id~~' ) {
refreshTags ( this ) ;
}
} else {
//Если выбран родитель
if ( parentSelected ( ) ) {
unSelectParent ( this ) ;
unSelectItem ( this ) ;
refreshTags ( DOMParentCheckbox ) ;
deleteTag ( DOMParentCheckbox ) ;
createTagList ( DOMSublist ) ;
if ( DOMHighestCheckbox . checked ) {
unSelectItem ( DOMHighestCheckbox ) ;
refreshTags ( DOMHighestCheckbox ) ;
deleteTag ( DOMHighestCheckbox ) ;
}
} else {
unSelectItem ( this ) ;
refreshTags ( this ) ;
deleteTag ( this ) ;
}
//убрать все дочерние
if ( DOMSublistInner ) {
unSelectSublist ( this ) ;
refreshTags ( this ) ;
}
}
} else {
if ( this . checked ) {
selectItem ( this ) ;
refreshTags ( this ) ;
createTag ( this ) ;
}
//выбрать все дочерние
if ( DOMSublistInner ) {
selectSublist ( this ) ;
}
if ( DOMSublistInner && $ ( DOMSublistInner ) . find ( '.' + checkboxClass ) [ 0 ] . value != '~~id~~' ) {
refreshTags ( this ) ;
}
} else {
//Если выбран родитель
if ( parentSelected ( ) ) {
unSelectParent ( this ) ;
unSelectItem ( this ) ;
refreshTags ( DOMParentCheckbox ) ;
deleteTag ( DOMParentCheckbox ) ;
createTagList ( DOMSublist ) ;
if ( DOMHighestCheckbox . checked ) {
unSelectItem ( DOMHighestCheckbox ) ;
refreshTags ( DOMHighestCheckbox ) ;
deleteTag ( DOMHighestCheckbox ) ;
}
} else {
unSelectItem ( this ) ;
refreshTags ( this ) ;
deleteTag ( this ) ;
}
//убрать все дочерние
if ( DOMSublistInner ) {
unSelectSublist ( this ) ;
refreshTags ( this ) ;
}
}
triggerSetText ( ) ;
} ) ;
@ -1209,9 +1230,15 @@ if (EXPO.searchBlock){
* @ param { number } id
* @ private
* /
_checkCheckBox : function ( id ) {
_checkCheckBox : function ( id , strict ) {
var self = this ,
$chckBox = $ ( '#id_' + id , self . $selfContainer ) ;
if ( strict ) {
this . strictMode = true ;
} else {
this . strictMode = false ;
}
if ( $chckBox . length && ! $chckBox . prop ( 'checked' ) ) {
$chckBox . prop ( 'checked' , true ) ;
$chckBox . trigger ( 'change' ) ;
@ -2075,7 +2102,7 @@ if (EXPO.searchBlock){
EXPO . searchBlock . placesModal . _loadParentTree ( data , function ( ) {
EXPO . searchBlock . placesModal . _checkCheckBox ( id , nam e) ;
EXPO . searchBlock . placesModal . _checkCheckBox ( id , tru e) ;
} ) ;
} ) ;
} else {