web crate put add table

This commit is contained in:
Filipriec
2026-08-23 23:43:27 +02:00
parent a44dccf84b
commit b4135e5d20
14 changed files with 239 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
{# GET /admin/tables/columns/add — crate::pages::admin::table_definition::ui::AddColumnsPage #}
{% extends "ui/base.html" %}
{% block title %}{{ nav.tr("td-add-columns-title") }}{% endblock %}
{% block title %}{{ nav.tr("td-adjust-columns-title") }}{% endblock %}
{% block content %}
<main>

View File

@@ -3,12 +3,39 @@
{% if page.table_is_writable() %}
<section class="panel">
<h2>{{ nav.tr("td-add-columns-to") }} <code>{{ page.selection.table }}</code></h2>
<p class="hint">{{ nav.tr("td-append-hint") }}</p>
<h2>{{ nav.tr("td-adjust-columns-of") }} <code>{{ page.selection.table }}</code></h2>
<p class="hint">{{ nav.tr("td-adjust-hint") }}</p>
<form id="column-form"
hx-post="/admin/tables/columns/add{{ page.selection.query() }}"
hx-target="#table-panel" hx-swap="innerHTML"
hx-disabled-elt="button[type=submit]">
{% if let Some(detail) = page.detail %}
<input type="hidden" name="expected_row_version" value="{{ detail.row_version }}">
<h3>{{ nav.tr("td-existing-columns") }}</h3>
<table class="builder-table">
<thead><tr><th>{{ nav.tr("td-remove-column") }}</th><th>{{ nav.tr("td-col-name") }}</th><th>{{ nav.tr("td-col-type") }}</th><th>{{ nav.tr("td-col-notes") }}</th></tr></thead>
<tbody>
{% for column in detail.columns %}
<tr>
<td>
{% if column.is_removal_choice() %}
<input type="checkbox" name="remove_column_ids" value="{{ column.column_id }}"
aria-label="{{ nav.tr_args("td-remove-column-aria", [("column", column.name.clone())]) }}"
{% if page.column_is_selected_for_removal(column.column_id) %}checked{% endif %}>
{% else %}<span class="hint"></span>{% endif %}
</td>
<td><code>{{ column.name }}</code></td>
<td>{{ column.field_type }}</td>
<td>
{% if column.generated %}<span class="tag">{{ nav.tr("column-flag-generated") }}</span>{% endif %}
{% if column.read_only %}<span class="tag">{{ nav.tr("column-flag-read-only") }}</span>{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<h3>{{ nav.tr("td-new-columns") }}</h3>
<div id="column-panel">
{% include "pages/admin/table_definition/column_panel.html" %}
</div>

View File

@@ -216,5 +216,5 @@
{% endfor %}
<div class="form-actions">
<button type="submit">{{ nav.tr_count("td-add-columns-button", "count", page.columns.added.len() as i64) }}</button>
<button type="submit">{{ nav.tr("td-save-definition") }}</button>
</div>

View File

@@ -40,7 +40,7 @@
{% if page.selection.has_table() %}
{% if page.table_is_writable() %}
<a href="/admin/tables/columns/add{{ page.selection.query() }}" class="tab {% if page.is("add-columns") %}selected{% endif %}" {% if page.is("add-columns") %}aria-current="page"{% endif %}>
<span>{{ nav.tr("td-tab-add-columns") }}</span><small>{{ nav.tr("td-tab-add-columns-sub") }}</small>
<span>{{ nav.tr("td-tab-adjust-columns") }}</span><small>{{ nav.tr("td-tab-adjust-columns-sub") }}</small>
</a>
<a href="/admin/tables/presentation{{ page.selection.query() }}" class="tab {% if page.is("presentation") %}selected{% endif %}" {% if page.is("presentation") %}aria-current="page"{% endif %}>
<span>{{ nav.tr("td-tab-presentation") }}</span><small>{{ nav.tr("td-tab-presentation-sub") }}</small>