master #172
@ -12,24 +12,16 @@
|
|||||||
element = $(element);
|
element = $(element);
|
||||||
var cssClass = "badge rlp-r"
|
var cssClass = "badge rlp-r"
|
||||||
|
|
||||||
var directParent = element.closest(".tree-element-children")
|
// Find all already tagged input elements and reset them to be untagged
|
||||||
var root = element.parents(".tree-element-children")
|
var allTaggedInputs = $("#tree-root").find(".badge.rlp-r")
|
||||||
|
allTaggedInputs.removeClass(cssClass)
|
||||||
|
|
||||||
var otherCheckedInputsOfParent = directParent.find('.tree-input:checked');
|
// Find all parents of selected element
|
||||||
var otherCheckedInputsOfRoot = root.find('.tree-input:checked');
|
var parentElements = element.parents(".tree-element-children")
|
||||||
|
|
||||||
if(otherCheckedInputsOfParent.length == 0){
|
|
||||||
var parentLabel = directParent.siblings(".tree-label");
|
|
||||||
parentLabel.removeClass(cssClass)
|
|
||||||
if(otherCheckedInputsOfRoot.length == 0){
|
|
||||||
var rootLabel = root.siblings(".tree-label")
|
|
||||||
rootLabel.removeClass(cssClass)
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
var rootAndParentLabel = root.siblings(".tree-label");
|
|
||||||
rootAndParentLabel.addClass(cssClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Tag parents of element
|
||||||
|
var parentLabels = parentElements.siblings(".tree-label");
|
||||||
|
parentLabels.addClass(cssClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeHandler(event){
|
function changeHandler(event){
|
||||||
|
Loading…
Reference in New Issue
Block a user