{# @description The page title: an eyebrow, the title, a lead, an info dialog trigger and the page's actions, drawn in one of the title layouts. #} {# @prop layout:text | description:"The title layout: default, inline, centred, compact, or a Cotton component of the project's own. Empty draws default, or inline with inline_actions." #} {# @prop title:text | description:"Page heading text." #} {# @prop eyebrow:text | description:"Short line above the heading, such as a category or the kind of record." #} {# @prop lead:text | description:"A sentence or two under the heading." #} {# @prop class:text | description:"Extra classes on the wrapper element." #} {# @prop info:text | description:"Text shown in the info dialog opened from the icon beside the heading." #} {# @prop info_actions:text | description:"Actions rendered in the info dialog's footer." #} {# @prop inline_actions:boolean | description:"Draw the inline layout when no layout is named." #} {# @slot:heading — The heading's text, in place of title. #} {# @slot:info_trigger — In place of the trigger drawn from info and info_actions. #} {# @slot:actions — The page's actions. As an attribute, a list of c-button attribute dicts, like page_actions. #} {% load mvp %} {# Every name has an empty default so a bare call never reads the page's own variables #} {# (docs/adr/0037-page-title-layouts-are-named-cotton-components.md). #} {% if layout %} {% firstof layout as chosen %} {% elif inline_actions %} {% firstof "inline" as chosen %} {% else %} {% firstof "default" as chosen %} {% endif %} {{ eyebrow }} {% if heading|slot_is_empty is False %}{{ heading }}{% else %}{{ title }}{% endif %} {{ lead }} {% if info_trigger|slot_is_empty is False %}{{ info_trigger }}{% else %}{% endif %} {# A list of dicts, the view's own shape, is drawn as buttons; slot content is drawn as it is. #} {% if actions|slot_is_empty is None %}{% for action in actions %}{% endfor %}{% else %}{{ actions }}{% endif %}