diff --git a/public/js/components/Cis/Menu.js b/public/js/components/Cis/Menu.js index 92e189af3..9608bc9de 100755 --- a/public/js/components/Cis/Menu.js +++ b/public/js/components/Cis/Menu.js @@ -21,15 +21,25 @@ export default { entries: [], activeEntry:null, url:null, - highestMatchingUrlCount:0, + urlMatchRankings:[], }; }, - methods:{ - checkHighestMatchingUrlCount(count){ - if(count > this.highestMatchingUrlCount) - { - this.highestMatchingUrlCount = count; + computed:{ + highestMatchingUrlCount(){ + // gets the hightest ranking inside the array + let highestMatch = Math.max(...this.urlMatchRankings); + + if(this.urlMatchRankings.length > 0){ + // if more than one entry has the same ranking, none should be active + return this.urlMatchRankings.filter((value)=>value == highestMatch).length > 1 ? null : highestMatch; } + + return null; + }, + }, + methods:{ + addUrlCount(count){ + this.urlMatchRankings.push(count); }, setActiveEntry(content_id){ @@ -51,6 +61,15 @@ export default { + +