kontent-ai / kontent-ai/java-packages
Add 'Kentico' dialect for Thymeleaf engine
- Dominant language
- Java
- Stars
- 17
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
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](https://www.thymeleaf.org/doc/tutorials/3.0/extendingthymeleaf.html).)
### 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.
### Reference
* https://www.thymeleaf.org/doc/tutorials/3.0/extendingthymeleaf.html
Contributor guide
Research direction
Start by reading the linked Thymeleaf extending guide and examining how the SDK's inline linked items rendering engine and application rendering engine are structured. Define the dialect's expressions and content resolvers, then verify that it can be registered in both rendering contexts as required by the design guidelines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100