Inline conditions

Using the new when helper you can easily filter work items and other objects in your template without creating labels. For the most part we recommend using custom labels to segment work items in your documents.

Sometimes you may want to be a bit more flexible and don't want to be forced to create labels to filter work items.

Example using labels


For this section to work you have to define the label titleContainsIOS separately.

{{#section 'titleContainsIOS'}}

{{#workItems}}
- {{title}}
{{/workItems}}

{{/section}}

Example using the when helper

Using the when helper you can define the condition inline.

{{#section (when 'Title' operator='contains' value='IOS') }}

{{#workItems}}
- {{title}}
{{/workItems}}

{{/section}}

More usage scenarios

Currently the when helper is supported as a sub expression in the workItems, filter, section and count helpers to filter work items.

However it also enables filtering objects that don't have labels applied like attachments. The attachmentSection helper enables you to filter attachments with the when helper as well:


{{#attachmentSection (when 'comment' operator='contains' value='release notes')}}

{{#attachments}}
- [{{title}}]({{url}})
{{/attachments}}

{{/attachmentSection}}

The when helper allows you to specify conditions just like the if-field helper.