web aliasing of accounting and others

This commit is contained in:
Priec
2026-08-13 19:05:41 +02:00
parent 6c15fcedc8
commit 8662b00ccf
7 changed files with 161 additions and 33 deletions

View File

@@ -238,7 +238,7 @@
<li><code>account_id</code> <span class="hint">system column — the account each row is posted to, written as <code>account</code></span></li>
{% endif %}
</ul>
<p class="hint">Each of these can be given a name of your own in the column list once the row is added; leave a field empty to keep the name shown here.</p>
<p class="hint">Each of these can be given a name of your own under <em>Rename generated columns</em> once the row is added; leave a field empty to keep the name shown here.</p>
<p class="hint">These names are reserved: no column of your own may use them, and the table may hold only one <code>{{ page.draft.columns.pending_compound_name() }}</code>. They land where this row sits in the column list, and can be moved with it.</p>
</div>
{% endif %}
@@ -279,17 +279,9 @@
</td>
<td>
<code>{{ row.name }}</code>
{#
A generated column is named by the backend, so it cannot be
named in the request that creates the table — but the name is a
display name, and an alias here is applied as a rename as soon
as the table exists. Leaving it empty keeps the backend's name.
#}
{% if let Some(source) = row.alias_source %}
<input type="hidden" name="generated_alias_sources" value="{{ source }}">
<input name="generated_alias_names" value="{{ row.alias }}"
aria-label="Alias for {{ source }}" placeholder="alias for {{ source }}">
{% endif %}
{# The list only reports a rename; it is asked for below, so that
this column stays something to read. #}
{% if !row.alias.is_empty() %}<span class="tag">renamed to {{ row.alias }}</span>{% endif %}
</td>
<td>{{ row.data_type }}</td>
<td>
@@ -334,6 +326,36 @@
{% endfor %}
</section>
{#
Renaming what a definition row generates. A generated column is named by the
backend, so it cannot be named in the request that creates the table — but the
name is a display name, and an alias here is applied as a rename as soon as
the table exists. Leaving a field empty keeps the backend's name.
It is a closed `<details>`, so the default — the backend's names — costs
nothing to read past. Fields inside a closed `<details>` are still part of the
form, so the aliases travel with every builder post either way.
#}
{% if !page.alias_rows().is_empty() %}
<section class="builder-section">
<details class="rename-generated">
<summary>Rename generated columns</summary>
<p class="hint">These columns come from the definition rows above. Give one a name of your own, or leave it empty to keep the name shown.</p>
<ul class="rename-list">
{% for row in page.alias_rows() %}
<li>
<code>{{ row.source }}</code>
<span class="hint">{{ row.data_type }}</span>
<input type="hidden" name="generated_alias_sources" value="{{ row.source }}">
<input name="generated_alias_names" value="{{ row.alias }}"
aria-label="Rename {{ row.source }}" placeholder="{{ row.source }}">
</li>
{% endfor %}
</ul>
</details>
</section>
{% endif %}
<section class="builder-section">
{% for table in page.draft.relation_tables %}
<input type="hidden" name="relation_tables" value="{{ table }}">