{# 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 -%} {%- 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 -%} {# // If you need to include extra fields on a select option // format a JSON string in 'data-extra' like this: // // // // Also see the showFields case below in the formSelectStandalone macro. // -matt #} {%- 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 '' %} {%- endmacro -%} {%- macro formMultiSelect(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 '' %} {%- 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) -%} {%- 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) -%} {%- 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 -%}