Thanks for the tip Jason.
I ended giving the container “active-1” until “active-6” classes in the modeler depending on the active page and then indeed use a Sass for loop to adapt the styling.
// Style links based on active page
$links: 6;
$class-slug: active !default
// Create custom nth-child selectors for each active value
@for $i from 1 through $links {
.#{$class-slug}-#{$i} {
.ps_left-menu-link:nth-child(#{$i}) {
& span a{
text-decoration: underline;
}
}
}
}
Hi Jason,
Perhaps you can do something with javascript. here is a short snippet that does what you want
for ( var widget of dijit.registry.toArray() ) {
if ( widget.action &&
widget.action.config &&
widget.domNode &&
widget.mxform &&
widget.action.type == "openPage" &&
widget.action.config.name == widget.mxform.path ) {
widget.domNode.classList.add("active");
}
}
The idea is to check the widget if it is an openPage button and that it is configured opens the current page (on which the button is). You can wrap this in a custom widget or put it in HTML/Snippet or in index.html.
-Andrej
PS: It might bet that it needs some tweeking for different Mx versions, this one is for Mx7.14
Thx Andrej,
Your answer is awesome, and what I was afraid of.
We are going to have 8 unique snippets instead, due to future maintainability.
I hope we get conditional classes soon.