I would like to put a button (link to documentation) based on which app is loaded. How would I access active app.id
in navbar.html
?
A bonus question: is there a list of all variables available in a template? I could find only a few.
I would like to put a button (link to documentation) based on which app is loaded. How would I access active app.id
in navbar.html
?
A bonus question: is there a list of all variables available in a template? I could find only a few.
Sounds like an interesting proposal. I am interested in this too because i can build Custom navbar - but it cannot be app-specific.
Hi,
The variables that are added by BaseController are just a few of the things you can access. Since these expressions are resolved by a SPEL context (see https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions), you can also reference beans and perform functions on them.
For example, this code will take the current app id from the URL and print it in a span
.
If no app is active, it prints ‘None’.
<span th:text="${#httpServletRequest.requestURI.contains('/app/') ? #httpServletRequest.requestURI.substring(5) : 'None'}"></span>