{# Standard form markup, for convenience and consistency #} {% macro formText(name, label, options = {}) %}
{% endmacro %} {% macro formPassword(name, label) %}
{% endmacro %} {% macro formTags(name, label) %}
{% endmacro %} {# Maybe fancier later #} {% macro formEmail(name, label) %} {{ formText(name, label) }} {% endmacro %} {# Typically we enhance this with jquery ui datepicker later #} {% macro formDate(name, label) %} {{ formText(name, label) }} {% endmacro %} {% macro formTime(name, label) %} {{ formText(name, label) }} {% endmacro %} {% macro formTextarea(name, label) %}
{% endmacro %} {% macro formSelect(name, label, choices) %}
{{ formSelectStandalone(name, choices) }}
{% endmacro %} {# Often useful in a custom fieldset with other controls #} {% macro formSelectStandalone(name, choices, _attrs = {}) %} {% endmacro %} {# Less ambiguous to work with than a checkbox #} {% macro formBoolean(name, label) %} {{ formSelect(name, label, [ { value: '1', label: 'Yes' }, { value: '0', label: 'No' }]) }} {% endmacro %} {% macro formBooleanStandalone(name, attrs) %} {{ formSelectStandalone(name, [ { value: '1', label: 'Yes' }, { value: '0', label: 'No' }], attrs) }} {% endmacro %} {# See enableSingleton in snippets' main.js for the necessary plumbing, including #} {# specifying the type we want for the singleton #} {% macro formSingleton(name, label) %}
{# js adds this singleton to the dialog #}
{% endmacro %} {# See enableArea in snippets' main.js for the necessary plumbing #} {# (TODO: factor that out to content.js or editor.js) #} {% macro formArea(name, label) %}
{# js adds this area to the dialog #}
{% endmacro %} {# See $.selective in content.js for the necessary plumbing #} {% macro formSelective(name, label, options = {}) %}
Limit Reached!
{% endmacro %} {# A pill button with several mutually exclusive choices (a nicer radio button basically). This is not a complete fieldset, see formPill. Often used to build filters, several on a line #} {# Sometimes a pill button group is useful without a fieldset #} {# Designed to be plumbed with javascript, note the data attributes #} {% macro formPillStandalone(name, options) %} {%- for pill in options -%} {{ pill.label }} {%- endfor -%} {% endmacro %} {# Pill button group wrapped in a fieldset like the rest #} {% macro formPill(name, label, options) %}
{{ formPillStandalone(name, options) }}
{% endmacro %}