{#
Email components
--
A set of useful helper macros that can be used inside of an email template
to layout the content.
--------------------------------------------------------------------------------
{%- import "../components/email.html" as _email -%}
--------------------------------------------------------------------------------
#}
{#
Spacer
--
A table with a set height against it, used to emulate vertical margin
between 2 elements. By standard, the height of the spacer is 20px, but the
macro can be passed a `type` value which can be used to modify this height:
`small` - Small height spacer
`large` - Large height spacer
`mobile-compact` - Standard height spacer, but small in mobile devices
The macro also accepts a custom `class` attribute.
--------------------------------------------------------------------------------
{{ _email.spacer(type='large') }}
--------------------------------------------------------------------------------
#}
{% macro spacer(type=None, class=None) %}
{% if heading_text %}
{{ content_heading(heading_text) }}
{% endif %}
{{ caller() }}
|
{% endmacro %}
{#
Content heading
--
The `content_heading` can be used within the `content` macro. It is a
pre-formatted heading used at the top of the `content` macro. Must be passed
a `text` attribute. It can also be passed a custom `class` attribute.
--------------------------------------------------------------------------------
{{ _email.content_heading('My heading') }}
--------------------------------------------------------------------------------
#}
{% macro content_heading(text, class=None) %}
|
|
{%- if caller -%}
{{ caller() }}
{%- elif text -%}
{{ text }}
{%- endif -%}
|
|
|
{% endmacro %}
{#
Content list
--
The `content_list` can be used within the `content` macro. It is a container
used to wrap a list of `content_rows` to layout data in a standard tabular
format. The macro can be passed a custom `class` attribute.
--------------------------------------------------------------------------------
{%- call _email.content_list() -%}
...
{%- endcall -%}
--------------------------------------------------------------------------------
#}
{% macro content_list(class=None) %}
{% if label_text %}
{{ label_text }}
|
|
{% endif %}
|
|
{%- if caller -%}
{{ caller() }}
{%- elif text -%}
{{ text }}
{%- endif -%}
|
|
|
|
{% endmacro %}