{# This macro must be imported 'with context' from a pieces module #} {# subclass. -Tom #} {# bring in modals #} {%- import "apostrophe-modal:macros.html" as modals -%} {# bring in ui components #} {% import 'apostrophe-ui:components/buttons.html' as buttons with context %} {% import 'apostrophe-ui:components/dropdowns.html' as dropdowns with context %} {% import 'apostrophe-ui:components/pills.html' as pills with context %} {% import 'apostrophe-ui:components/fields.html' as fields with context %} {# Maintained for bc. Newer templates call the module's createControls helper. #} {%- macro createControls() -%} {{ dropdowns.base({ label: 'More', items: [ {label: 'Copy', action: 'copy'}, {label: 'Trash', action: 'trash'} ]}, 'button', { direction: 'down', class: 'arrow-down' } ) }} {{ buttons.minor('Cancel', { action: 'cancel' }) }} {{ buttons.major('Save ' + data.options.label, { action: 'save' }) }} {% endmacro %} {# Maintained for bc. Newer templates call the module's editControls helper. #} {%- macro editControls() -%} {{ dropdowns.base({ label: 'More', items: [ {label: 'Versions', action: 'versions'}, {label: 'Copy', action: 'copy'}, {label: 'Trash', action: 'trash'} ]}, 'button', { direction: 'down', class: 'arrow-down' } ) }} {{ buttons.minor('Cancel', { action: 'cancel' }) }} {{ buttons.major('Save ' + data.options.label, { action: 'save' }) }} {%- endmacro -%} {%- macro manageControls() -%} {% if data.chooser %} {{ buttons.minor('Cancel', { action: 'cancel' }) }} {# "New" is less ambiguous than "Add" when you're already *choosing* things. -Tom #} {% if data.options.insertViaUpload %} {{ buttons.major('New ' + data.options.label, { action: 'upload-' + data.options.name }) }} {% else %} {{ buttons.major('New ' + data.options.label, { action: 'create-' + data.options.name }) }} {% endif %} {{ buttons.major('Save Choices', { action: 'save' }) }} {% else %} {# Technically it's "just" a cancel button but it's actually the most frequent action #} {# when you're just managing stuff. There is no risk of losing work. -Tom #} {{ buttons.minor('Finished', { action: 'cancel' }) }} {% if data.options.insertViaUpload %} {{ buttons.major('Add ' + data.options.label, { action: 'upload-' + data.options.name }) }} {% else %} {{ buttons.major('Add ' + data.options.label, { action: 'create-' + data.options.name }) }} {% endif %} {% endif %} {%- endmacro -%} {%- macro filters(filters) -%} {# Normal cursor-driven filters #}
{{ fields.checkbox('select-all') }} {%- for filter in filters.options -%} {%- if not apos.utils.isFalse(filter.label) -%} {%- endif -%} {%- if filter.multiple -%} {%- for chosen in filters.choices[filter.name] -%} {% set id = apos.utils.generateId() %} {%- endfor -%} {{ fields.select(filter.name, apos.utils.concat([ { label: 'Choose One', value: '**CHOOSE**' } ], apos.utils.difference(filter.choices, filters.choices[filter.name], 'value')), '**CHOOSE**') }} {%- else -%} {{ fields.select(filter.name, apos.utils.concat([ { label: filter.anyLabel or '—', value: "**ANY**" } ], filter.choices), filters.choices[filter.name]) }} {%- endif -%} {%- endfor -%}
{# Search #}
{% include "manageSelectEverything.html" %} {%- endmacro -%}