HandlebarsHelpers

HandlebarsHelpers

A collection of Handlebars template helpers which can be used within HTML templates.

Constructor

new HandlebarsHelpers()

Source:

Methods

(static) checked() → {string}

Source:

For checkboxes, if the value of the checkbox is true, add the "checked" property, otherwise add nothing.

Returns:
Type
string

(static) editor() → {Handlebars.SafeString}

Source:

Construct an editor element for rich text editing with TinyMCE

Returns:
Type
Handlebars.SafeString

(static) filePicker() → {Handlebars.SafeString|string}

Source:

Render a file-picker button linked to an field

Returns:
Type
Handlebars.SafeString | string

(static) localize() → {string}

Source:

Translate a provided string key by using the loaded dictionary of localization strings.

Example

Translate a provided localization string, optionally including formatting parameters

<label>{{localize "ACTOR.Create"}}</label> <!-- "Create Actor" -->
<label>{{localize "CHAT.InvalidCommand", command=foo}}</label> <!-- "foo is not a valid chat message command." -->
Returns:
Type
string

(static) numberFormat() → {string}

Source:

A string formatting helper to display a number with a certain fixed number of decimals and an explicit sign.

Returns:
Type
string

(static) radioBoxes(name, choices) → {Handlebars.SafeString}

Source:

A helper to create a set of radio checkbox input elements in a named set. The provided keys are the possible radio values while the provided values are human readable labels.

Examples

The provided input data

let groupName = "importantChoice";
let choices = {a: "Choice A", b: "Choice B"};
let chosen = "a";

The template HTML structure

<div class="form-group">
  <label>Radio Group Label</label>
  <div class="form-fields">
    {{radioBoxes groupName choices checked=chosen localize=true}}
  </div>
</div>
Parameters:
Name Type Description
name string

The radio checkbox field name

choices object

A mapping of radio checkbox values to human readable labels

options.checked string

Which key is currently checked?

options.localize boolean

Pass each label through string localization?

Returns:
Type
Handlebars.SafeString

(static) select() → {Handlebars.SafeString}

Source:

A helper to assign an

Examples

The provided input data

let choices = {a: "Choice A", b: "Choice B"};
let value = "a";

The template HTML structure

<select name="importantChoice">
  {{selectOptions choices selected=value localize=true}}
</select>
Parameters:
Name Type Description
choices object

A mapping of radio checkbox values to human readable labels

options.selected string | Array.<string>

Which key or array of keys that are currently selected?

options.localize boolean

Pass each label through string localization?

Returns:
Type
Handlebars.SafeString