BlazeTemplateHelpers

BlazeTemplateHelpers

Source:

Meteor Blaze Template helper methods - Use these helpers in Meteor Blaze templates with {{ }} Read more about Meteor Blaze helpers in the Blaze Documentation.

Members

(static) reactionApps

Return an array of filtered, structured reactionApps as a Template Helper

Source:
Examples
{{#each reactionApps provides="settings" name=packageName container=container}}
{{#each reactionApps provides="userAccountDropdown" enabled=true}}

(static) reactionTemplate

use the reactionTemplate helper when you are using templates defined as workflow templates in the package registry.Layout use "collection" on the layout to indicate a workflow source

Source:

reactionTemplate provides templates as defined in ReactionRegistry.Layout

Methods

(static) active() → {String}

template helper for Router.isActiveClassName

Source:
Returns:

username

Type
String

(static) allowGuestCheckout() → {Boolean}

check if guest users are allowed to checkout, uses alanning:meteor-roles

Source:
Returns:

return true if shop has guest checkout enabled

Type
Boolean

(static) capitalize(str) → {String}

capitalize first character of string

Source:
Parameters:
Name Type Description
str String

string

Returns:

returns string with first letter capitalized

Type
String

(static) cart() → {Object}

methods to return cart calculated values cartCount, cartSubTotal, cartShipping, cartTaxes, cartTotal are calculated by a transformation on the collection and are available to use in template as cart.xxx

Source:
Example
{{cart.getCount}}
Returns:

returns inventory helpers

Type
Object

(static) cartPayerName() → {String}

gets current cart billing address / payment name

Source:
Example
{{>afFieldInput name="payerName" value=cartPayerName}}
Returns:

returns cart.billing[0].fullName

Type
String

(static) condition(v1, operator, v2) → {Boolean}

conditional string comparison template helper

Source:
Example
{{#if condition status "eq" ../value}}
Parameters:
Name Type Description
v1 String

first variable to compare

operator String

eq,neq,ideq,or,lt,gt comparision operator

v2 String

second variable to compare

Returns:

returns true/false

Type
Boolean

(static) currencySymbol() → {String}

Return shop /locale specific currency format (ie: $)

Source:
Returns:

return current locale currency symbol

Type
String

(static) currentUser() → {Boolean}

overrides Meteor Package.blaze currentUser method

Source:
Returns:

returns true/null if user has registered

Type
Boolean

(static) displayName() → {String}

Return a registered and logged in user's name or Guest

Source:
Returns:

username

Type
String

(static) displayName() → {String}

Return a registered and logged in user's name or Guest

Source:
Returns:

username

Type
String

(static) formatPrice(currentPrice, useDefaultShopCurrency) → {String}

Return shop /locale specific formatted price. Also accepts a range formatted with " - "

Source:
Example
{{formatPrice displayPrice}}
Parameters:
Name Type Description
currentPrice String

currentPrice or "xx.xx - xx.xx" formatted String

useDefaultShopCurrency Boolean

flag for displaying shop's currency in Admin view of PDP

Returns:

returns locale formatted and exchange rate converted values

Type
String

(static) hasAdminAccess() → {Boolean}

check if user has admin access, uses alanning:meteor-roles

Source:
Returns:

return true if admin

Type
Boolean

(static) hasDashboardAccess() → {Boolean}

check if user has dashboard access, uses alanning:meteor-roles

Source:
Returns:

return true if user has dashboard permission

Type
Boolean

(static) hasOwnerAccess() → {Boolean}

check if user has owner access, uses alanning:meteor-roles

Source:
Returns:

return true if owner

Type
Boolean

(static) hasPermission("permissions", options) → {Boolean}

check current user hasPermission, uses alanning:meteor-roles

Source:
Example
{{hasPermission admin userId}}
Parameters:
Name Type Description
"permissions" String | Array
options String

object

Returns:
Type
Boolean

(static) i18n(i18nKey, i18nMessage) → {String}

Pass the translation key as the first argument and the default message as the second argument

Source:
See:
Example
{{i18n "accountsTemplate.error" "Invalid Email"}}
Parameters:
Name Type Description
i18nKey String

i18nKey

i18nMessage String

message text

Returns:

returns i18n translated message

Type
String

(static) key_value(context) → {Array}

template helper pushing object key/value into array

Source:
Parameters:
Name Type Description
context Object

object to parse into key / value

Returns:

returns array[key:,value:]

Type
Array

(static) monthOptions(showDefaultOptionopt) → {Array}

Get monthOptionsVar ReactiveVar

Source:
Parameters:
Name Type Attributes Description
showDefaultOption Boolean <optional>
Returns:

returns array of months

Type
Array

(static) nl2br(text) → {String}

template helper nl2br - Converts new line (\n\r) to
from http://phpjs.org/functions/nl2br:480

Source:
Parameters:
Name Type Description
text String

text

Returns:

returns formatted Spacebars.SafeString

Type
String

(static) orElse(v1, v2) → {String}

if this is true, or else this

Source:
Example
{{#if showCartIconWarning}}
  <div class="badge badge-warning">!</div>
  {{/if}}
  <div class="badge">{{orElse cartCount 0}}</div>
Parameters:
Name Type Description
v1 String

variable one

v2 String

variable two

Returns:

returns v1 || v2

Type
String

(static) pathFor() → {String}

template helper to return path

Source:
Returns:

username

Type
String

(static) pluralize(nCount, pString)

general helper for plurization of strings

Source:
To Do:
  • adapt to, and use i18next
Example
{{pluralize "1 thing"}}
Parameters:
Name Type Description
nCount String

number, ie "1 "

pString String

plural string ie " thing"

(static) reactionSubTags(parentTag) → {Array}

Template method to return subTags

Source:
Parameters:
Name Type Description
parentTag Object

Tag

Returns:

Array of subtags or empty Array

Type
Array

(static) siteName() → {String}

get the shop name

Source:
Example
<a href="{{pathFor 'index'}}"><span>{{siteName}}</span></a>
Returns:

returns site name

Type
String

(static) toCamelCase(str) → {String|undefined}

camelCases a string

Source:
Parameters:
Name Type Description
str String

string

Returns:

returns camelCased string

Type
String | undefined

(static) toLowerCase(str) → {String}

convert a string to lower case

Source:
Parameters:
Name Type Description
str String

string

Returns:

returns lowercased string

Type
String

(static) toUpperCase(str) → {String}

convert a string to upper case

Source:
Parameters:
Name Type Description
str String

string

Returns:

returns uppercased string

Type
String

(static) urlFor() → {String}

template helper to return absolute + path

Source:
Returns:

username

Type
String

(static) yearOptions(showDefaultOptionopt) → {Array}

formats moment.js next 9 years into array for autoform selector

Source:
Parameters:
Name Type Attributes Description
showDefaultOption Boolean <optional>
Returns:

returns array of years [value:, label:]

Type
Array