{# Standard form markup, for convenience and consistency #} {% macro formText(name, label, options = {}) %}
{% endmacro %} {% macro formPassword(name, label) %}
{% endmacro %} {% macro formTags(name, label, options) %} {% if options.inline %}
{% else %}
{% endif %}
{# Text entry for autocompleting the next item #} Add
  • {{ __('Example label') }} {# Link to remove this choice #}
{% if options.inline %}
{% else %} {% endif %} {% 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 formCheckboxes(name, label, choices) %}
{% endmacro %} {% macro formSelect(name, label, choices) %} {# check for a fields property on any of the choices, and add class if one exists #} {% set selectFields = ' apos-fieldset-select-show-fields' if aposContainsProperty(choices, 'showFields') else '' %}
{{ 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 #} {# moreOptions is merged with options. This makes it easier to #} {# pass some default options and then customize a few #} {% macro formSelective(name, label, options = {}, moreOptions = {}) %} {% set _options = aposMerge(options, moreOptions) %} {% if _options.inline %}
{% else %}
{% endif %} {{ __('Limit Reached!') }}
    {# This is a template for creating the real items, #} {# it will be cloned as needed #}
  • {{ __(Title) }}
    {% if _options.extras or _options.relationship %} {# TODO: extend our support for different types of extra fields, #} {# style them meaningfully. Usually on same row with item #} {% for extra in (_options.extras or _options.relationship) %} {% if (extra.type == 'checkbox') or (extra.type == 'boolean') %} {% elif (extra.type == 'string') or (extra.type == 'text') %} {% elif (extra.type == 'radio') %} {% for choice in extra.choices %} {{ choice.label | e }} {% endfor %} {% elif (extra.type == 'select') %} {{ formSelectStandalone(extra.name, extra.choices, { 'data-extras': '' }) }} {% else %} {{ aposLog("WARNING: unrecognized type for relationship field: ") }} {{ aposLog(extra) }} {% endif %} {% endfor %} {% endif %} {% if _options.propagate %} {{ __('Apply to Subpages') }} {% endif %}
{% if _options.inline %}
{% else %}
{% endif %} {% 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 %}