Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Kentico' dialect for Thymeleaf engine #62

Open
aweigold opened this issue Jul 29, 2018 · 0 comments
Open

Add 'Kentico' dialect for Thymeleaf engine #62

aweigold opened this issue Jul 29, 2018 · 0 comments
Labels
enhancement groomed The issue has been groomed and should be in a good shape. hacktoberfest help wanted

Comments

@aweigold
Copy link
Contributor

aweigold commented Jul 29, 2018

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.

Reference

@aweigold aweigold self-assigned this Jul 29, 2018
@JanLenoch JanLenoch added enhancement help wanted groomed The issue has been groomed and should be in a good shape. labels Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement groomed The issue has been groomed and should be in a good shape. hacktoberfest help wanted
Projects
None yet
Development

No branches or pull requests

3 participants