link in table definition

This commit is contained in:
Priec
2026-08-12 17:17:29 +02:00
parent fa50f29ff0
commit 08af99e334
8 changed files with 134 additions and 4 deletions

View File

@@ -98,8 +98,9 @@
<section class="builder-section">
<h2>Add a column</h2>
<div class="form-grid">
<label>Column name
<label>{% if page.draft.columns.show_link_target() %}Link alias{% else %}Column name{% endif %}
<input name="column_name_input" value="{{ page.draft.columns.name_input }}" placeholder="number">
{% if page.draft.columns.show_link_target() %}<small>The alias is the column name used to distinguish this relationship.</small>{% endif %}
</label>
<label>Column type
<select name="column_type_input" hx-post="/admin/tables/builder" hx-trigger="change"
@@ -147,6 +148,18 @@
</label>
{% endif %}
{% if page.draft.columns.show_link_target() %}
<label>Referenced table
<select name="link_table_input">
<option value="">Choose a table</option>
{% for table in page.draft.relation_tables %}
<option value="{{ table }}" {% if page.draft.columns.link_table_input == *table %}selected{% endif %}>{{ table }}</option>
{% endfor %}
</select>
{% if page.draft.relation_tables.is_empty() %}<small>No eligible tables exist in this scope.</small>{% endif %}
</label>
{% endif %}
{% if page.draft.columns.show_money_options() %}
<label>Currency
<input name="column_currency_input" value="{{ page.draft.columns.currency_input }}" list="currency-codes"

View File

@@ -23,8 +23,9 @@
{% endif %}
<div class="form-grid">
<label>Column name
<label>{% if page.columns.show_link_target() %}Link alias{% else %}Column name{% endif %}
<input name="column_name_input" value="{{ page.columns.name_input }}" placeholder="issued_on">
{% if page.columns.show_link_target() %}<small>The alias is the column name used to distinguish this relationship.</small>{% endif %}
</label>
<label>Column type
<select name="column_type_input"
@@ -74,6 +75,18 @@
</label>
{% endif %}
{% if page.columns.show_link_target() %}
<label>Referenced table
<select name="link_table_input">
<option value="">Choose a table</option>
{% for table in page.link_target_tables() %}
<option value="{{ table }}" {% if page.columns.link_table_input == *table %}selected{% endif %}>{{ table }}</option>
{% endfor %}
</select>
{% if page.link_target_tables().is_empty() %}<small>No eligible tables exist in this scope.</small>{% endif %}
</label>
{% endif %}
{% if page.columns.show_money_options() %}
<label>Currency
<input name="column_currency_input" value="{{ page.columns.currency_input }}" list="currency-codes"