{# 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 #}