-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Motivation
Say your application needs to show an alert text box in blue or red background depending on the user’s role (admin or non-admin). You can compute this with conditional expressions on your template, but too many conditions could render your code a little bit hard to read …
Solution: create a new Thymeleaf attribute called alertclass and an attribute processor for it (Java code that will compute the right CSS class), and package it into your own MyOwnDialect Thymeleaf dialect. Add this dialect to your template engine with the th prefix (same as the SpringStandard dialect) and you’ll now be able to use th:alertclass="${user.role}".
(Taken from the docu.)
Design guidelines
This Thymeleaf dialect should provide various expressions and content resolvers to simplify usage of KenticoCloud objects from within Thymeleaf. This dialect can be registered by an application's Thymeleaf rendering engine, as well as should be registered in the inline linked items rendering engine provided with the SDK.