Thymeleaf Extras Togglz

Thymeleaf dialect integrating Togglz feature toggles.

License

License

Categories

Categories

Leaf Data Databases
GroupId

GroupId

com.github.heneke.thymeleaf
ArtifactId

ArtifactId

thymeleaf-extras-togglz
Last Version

Last Version

2.0.1.RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

Thymeleaf Extras Togglz
Thymeleaf dialect integrating Togglz feature toggles.
Project URL

Project URL

https://github.com/heneke/thymeleaf-extras-togglz
Source Code Management

Source Code Management

https://github.com/heneke/thymeleaf-extras-togglz/tree/master

Download thymeleaf-extras-togglz

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.heneke.thymeleaf/thymeleaf-extras-togglz/ -->
<dependency>
    <groupId>com.github.heneke.thymeleaf</groupId>
    <artifactId>thymeleaf-extras-togglz</artifactId>
    <version>2.0.1.RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.heneke.thymeleaf/thymeleaf-extras-togglz/
implementation 'com.github.heneke.thymeleaf:thymeleaf-extras-togglz:2.0.1.RELEASE'
// https://jarcasting.com/artifacts/com.github.heneke.thymeleaf/thymeleaf-extras-togglz/
implementation ("com.github.heneke.thymeleaf:thymeleaf-extras-togglz:2.0.1.RELEASE")
'com.github.heneke.thymeleaf:thymeleaf-extras-togglz:jar:2.0.1.RELEASE'
<dependency org="com.github.heneke.thymeleaf" name="thymeleaf-extras-togglz" rev="2.0.1.RELEASE">
  <artifact name="thymeleaf-extras-togglz" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.heneke.thymeleaf', module='thymeleaf-extras-togglz', version='2.0.1.RELEASE')
)
libraryDependencies += "com.github.heneke.thymeleaf" % "thymeleaf-extras-togglz" % "2.0.1.RELEASE"
[com.github.heneke.thymeleaf/thymeleaf-extras-togglz "2.0.1.RELEASE"]

Dependencies

compile (2)

Group / Artifact Type Version
org.thymeleaf : thymeleaf jar 3.0.1.RELEASE
org.togglz : togglz-core jar 2.3.0.Final

test (3)

Group / Artifact Type Version
junit : junit jar 4.8.2
org.togglz : togglz-testing jar 2.3.0.Final
org.thymeleaf : thymeleaf-testing jar 3.0.1.RELEASE

Project Modules

There are no modules declared in this project.

Thymeleaf Togglz dialect

Thymeleaf dialect that integrates Togglz feature toggles (www.togglz.org) and the Thymeleaf template engine (www.thymeleaf.org).

Requirements

  • Thymeleaf
    • 2.1.x (works with older 2.0.x versions - see remark regarding expression evaulation) - using thymeleaf-extras-togglz version 1.x
    • 3.x - using thymeleaf-extras-togglz version 2.x
  • Togglz 2.3.x (works with older 2.x versions)

Usage

Add an instance of com.github.heneke.thymeleaf.togglz.TogglzDialect to your Thymeleaf template engine. In your templates, you may now use

<div togglz:active="YOUR_FEATURE_NAME">
    content only visible if feature is active
</div>
<div togglz:inactive="YOUR_FEATURE_NAME">
    content only visible if feature is <b>inactive</b>
</div>

to show/hide the markup container based on feature state.

Optionally, you may add an XML namespace to your <html> tag, to suppress warnings in your IDE:

<html lang="en"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:togglz="https://github.com/heneke/thymeleaf-extras-togglz">

Until recently, the expression processor for togglz:active did not support expressions. Since it does so now, you have to use

<div togglz:active="'YOUR_FEATURE_NAME'">
    content only visible if feature is active
</div>
<div togglz:inactive="'YOUR_FEATURE_NAME'">
    content only visible if feature is <b>inactive</b>
</div>
```

when using Thymeleaf 2.0.x. Thymeleaf 2.1 does support string literals without single quotes as explained in the usage section (see http://www.thymeleaf.org/whatsnew21.html#littok).

Versions

Version
2.0.1.RELEASE
2.0.0.RELEASE
1.2.0.RELEASE
1.1.0.RELEASE
1.0.1.RELEASE
1.0.0.RELEASE