Files
komp_ac/web/templates/pages/admin/table_definition/context.html
2026-08-14 20:35:37 +02:00

73 lines
4.0 KiB
HTML

{#
The heading and action switcher shared by the five table-definition pages.
Every one of them carries a `page` (crate::pages::admin::table_definition::
state::TableDefinitionPageState), whose `active` says which is open.
These are deliberately separate pages, for the same reason the permission
sections are: adding a column, dropping a table, copying a profile and
reading its rename history are four different decisions, and stacking them
on one screen was what made the old workspace impossible to find anything
in. Which links appear follows how much has been selected — the table-wide
ones need a table, the profile-wide ones only a profile.
#}
<section class="heading">
<div>
<p class="eyebrow">
{%- if page.selection.has_table() %}{{ page.selection.scope_label(nav.locale) }}{% else %}{{ nav.tr("td-eyebrow-table-definition") }}{% endif -%}
</p>
<h1>
{%- if page.selection.has_table() %}{{ page.selection.table }}{% else %}{{ page.selection.scope_label(nav.locale) }}{% endif -%}
</h1>
<p>
{%- if let Some(detail) = page.detail -%}
{{ nav.tr_count("td-columns-count", "count", detail.columns.len() as i64) }} · {{ nav.tr("td-identified-by") }}
{%- if detail.row_display_columns.is_empty() %} {{ nav.tr("td-its-id") }}
{%- else %} {{ detail.row_display_columns|join(", ") }}{% endif -%}
{%- if let Some(summary) = page.selected_table() -%}
{%- if !summary.depends_on.is_empty() %} · {{ nav.tr("td-depends-on-prefix") }} {{ summary.depends_on|join(", ") }}{% endif -%}
{%- endif -%}
.
{%- else -%}
{{ nav.tr("td-acts-on-profile") }}
{%- endif -%}
</p>
</div>
<div class="actions">
<a href="/admin{% if page.selection.has_table() %}{{ page.selection.query() }}{% else %}{{ page.selection.profile_query() }}{% endif %}">{{ nav.tr("ui-back-to-admin-panel") }}</a>
</div>
</section>
<nav class="tabs" aria-label="{{ nav.tr("td-tab-aria") }}">
{% if page.selection.has_table() %}
{% if page.table_is_writable() %}
<a href="/admin/tables/columns{{ page.selection.query() }}" class="tab {% if page.is("columns") %}selected{% endif %}" {% if page.is("columns") %}aria-current="page"{% endif %}>
<span>{{ nav.tr("td-tab-columns") }}</span><small>{{ nav.tr("td-tab-columns-sub") }}</small>
</a>
<a href="/admin/tables/delete{{ page.selection.query() }}" class="tab {% if page.is("delete") %}selected{% endif %}" {% if page.is("delete") %}aria-current="page"{% endif %}>
<span>{{ nav.tr("td-tab-delete") }}</span><small>{{ nav.tr("td-tab-delete-sub") }}</small>
</a>
{% endif %}
<a href="/permissions/grants" class="tab">
<span>{{ nav.tr("td-tab-access") }}</span><small>{{ nav.tr("td-tab-access-sub") }}</small>
</a>
{% endif %}
{% if page.selection.has_profile() && !page.selection.is_global() %}
<a href="/admin/profiles/copy{{ page.selection.profile_query() }}" class="tab {% if page.is("copy") %}selected{% endif %}" {% if page.is("copy") %}aria-current="page"{% endif %}>
<span>{{ nav.tr("td-tab-copy") }}</span><small>{{ nav.tr("td-tab-copy-sub") }}</small>
</a>
<a href="/admin/tables/from-template{{ page.selection.profile_query() }}" class="tab {% if page.is("template") %}selected{% endif %}" {% if page.is("template") %}aria-current="page"{% endif %}>
<span>{{ nav.tr("td-tab-template") }}</span><small>{{ nav.tr("td-tab-template-sub") }}</small>
</a>
<a href="/admin/profiles/history{{ page.selection.profile_query() }}" class="tab {% if page.is("history") %}selected{% endif %}" {% if page.is("history") %}aria-current="page"{% endif %}>
<span>{{ nav.tr("td-tab-history") }}</span><small>{{ nav.tr("td-tab-history-sub") }}</small>
</a>
{% endif %}
</nav>
{% if page.selection.has_table() && !page.table_is_writable() %}
<section class="panel">
<h2>{{ nav.tr("td-backend-managed-title") }}</h2>
<p class="hint">{{ nav.tr("td-backend-managed-hint")|safe }}</p>
</section>
{% endif %}