{% extends "tungsten/layout/app.html" %} {% import "tungsten/components/ui.html" as ui %} {% block content %} {% set v = page.view(ctx) %} {% set current = v.current %} {% set url = v.url %} {% if current %} {% set title = current.name %} {% set subheading = current.description %} {% endif %} {% set extra_actions %} {% if current %} {% if v.editing %} {{ ui.button('Done', 'primary', 'check', href=url(d=current.id)) }} {% elif v.editable %} {{ ui.button('Edit dashboard', 'gray', 'square-pen', href=url(d=current.id, edit=1), outlined=true) }} {% endif %} {% if (v.plugin.home and v.signed_in) or v.can_create %} {% call(part) ui.dropdown() %} {% if part == 'trigger' %}{{ ui.icon_button('ellipsis-vertical', 'More') }} {% else %} {% if v.plugin.home and v.signed_in %} {% set is_home = v.my_home == current.id %} {% endif %} {% if v.can_create %} {% endif %} {% endif %} {% endcall %} {% endif %} {% endif %} {% endset %} {% include "tungsten/components/page-header.html" %} {% if ctx.request.query_params.get('new') and v.can_create %} {# ?new=1 (the Quick Create menu links here): open the "New dashboard" form at once #} {% endif %} {% if v.missing %}
{{ __('That dashboard is gone or not shared with you, so here is another one.') if current else __('That dashboard is gone or not shared with you.') }}
{% endif %} {% if v.dashboards %} {% endif %} {% if not current %}
{% call ui.empty_state(__('No dashboards yet'), __('Click "New dashboard" to build one with the widgets you need.') if v.can_create else __('Nobody has shared a dashboard with you yet.'), 'layout-grid') %}{% endcall %}
{% else %} {% if v.editing %}
{{ icon('move', 'h-4 w-4') }}

{{ __('Drag widgets by their handle to move them. Pick a width for each one. Add more from the list below.') }}

{{ ui.button('Name and sharing', 'gray', 'settings', size='sm', outlined=true, attrs_='@click="open = !open"'|safe) }}
{% if v.can_share %} {% elif current.shared %} {% if current.home_for_all %}{% endif %} {% endif %} {% if v.plugin.home and v.signed_in %} {% endif %}
{{ ui.button('Save', 'primary', 'check', type='submit', size='sm') }}
{% endif %} {% if current.items %} {{ v.board }} {% endif %} {% if not current.items or not v.board | trim %}
{% call ui.empty_state(__('This dashboard is empty'), __('Add widgets from the list below.') if v.editing else (__('Click "Edit dashboard" to add widgets.') if v.editable else __('There is nothing on it you can see yet.')), 'layout-dashboard') %}{% endcall %}
{% endif %} {% if v.editing %}

{{ __('Add widgets') }}

{% if not v.catalog %}
{% call ui.empty_state(__('No widgets to add'), __('Install plugins or add widgets with panel.widgets([...]).'), 'layout-grid') %}{% endcall %}
{% endif %} {% for group, entries in v.catalog.items() %}

{{ group }}

{% for e in entries %} {% set placed = e.widget is not none and e.key in v.placed %}
{{ icon(e.icon or 'layout-dashboard', 'h-4 w-4') }}

{{ e.label }}

{% if e.description %}

{{ e.description }}

{% endif %}
{% if e.widget %}
{% if placed %}{{ ui.badge(__('On the dashboard'), 'success', 'check') }} {% else %} {% endif %}
{% else %}
{{ ui.button('Add', 'primary', 'plus', size='sm', outlined=true, attrs_='@click="open = !open" x-show="!open"'|safe) }}
{% with values = {}, title = '', key = e.key, prefix = 'new-' ~ loop.index ~ '-' ~ e.key.replace('.', '-'), resources = v.resources, links = v.links, max_note = v.max_note %} {% include "tungsten_dashboards/fields.html" %} {% endwith %}
{{ ui.button('Add', 'primary', 'plus', type='submit', size='sm') }} {{ ui.button('Cancel', 'gray', size='sm', outlined=true, attrs_='@click="open = false"'|safe) }}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %} {% endif %} {% endblock %}