50 lines
4.5 KiB
HTML
50 lines
4.5 KiB
HTML
{% extends 'base.html' %}{% block content %}
|
|
<h1>{% if category %}{{ t('categories.edit') }}{% else %}{{ t('categories.create') }}{% endif %}</h1>
|
|
<form method="post" enctype="multipart/form-data">
|
|
<label>{{ t('common.name') }}<input name="name" value="{{category.name if category else ''}}" required></label>
|
|
<label>{{ t('common.description') }}<textarea name="description">{{category.description if category and category.description else ''}}</textarea></label>
|
|
<div class="form-field category-image-editor" data-image-editor>
|
|
<label for="category-image-input">{{ t('categories.image') }}</label>
|
|
<div class="asset-edit-image-preview" id="category-current-image-preview" data-image-preview {% if not (category and category.image_path) %}hidden style="display:none"{% endif %}>
|
|
<img src="{{ category.image_path if category and category.image_path else '' }}" class="asset-edit-preview-image" alt="">
|
|
<div class="asset-edit-image-preview-actions">
|
|
<span class="muted">{{ t('categories.current_image', 'Aktuelles Kategoriebild') }}</span>
|
|
<button type="button" class="button button-danger button-small" id="remove-category-image-button" data-image-remove aria-pressed="false" {% if not (category and category.image_path) %}hidden disabled{% endif %}>{{ t('categories.remove_image', 'Kategoriebild entfernen') }}</button>
|
|
</div>
|
|
</div>
|
|
<input type="hidden" name="remove_image" id="remove-category-image" value="0" data-image-remove-input>
|
|
<div class="image-remove-pending" data-image-remove-pending hidden>{{ t('categories.image_remove_pending', 'Kategoriebild wird beim Speichern entfernt.') }}</div>
|
|
<div class="standard-image-library">
|
|
<strong>{{ t('images.library', 'Standardbild-Bibliothek') }}</strong>
|
|
<div class="muted image-library-help">{{ t('images.library_help', 'Wähle ein bereits vorhandenes Standardbild oder füge ein Bild einmalig zur Bibliothek hinzu.') }}</div>
|
|
{% if standard_images %}
|
|
<div class="standard-image-grid">
|
|
{% for item in standard_images %}
|
|
<label class="standard-image-choice" title="{{ item.name }}">
|
|
<input type="radio" name="library_image" value="{{ item.path }}" data-image-library-choice data-image-src="{{ item.path }}" {% if category and category.image_path == item.path %}checked{% endif %}>
|
|
<img src="{{ item.path }}" alt="">
|
|
<span>{{ item.name }}</span>
|
|
</label>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div class="muted image-library-empty">{{ t('images.library_empty', 'Noch keine Standardbilder vorhanden.') }}</div>
|
|
{% endif %}
|
|
<label class="image-upload-label">{{ t('images.library_upload', 'Neues Standardbild hinzufügen und verwenden') }}
|
|
<input type="file" name="library_upload" accept="image/*" data-image-library-upload>
|
|
</label>
|
|
<small class="muted">{{ t('images.library_upload_help', 'Das Bild wird einmal in der gemeinsamen Bibliothek gespeichert und kann danach bei weiteren Assets und Kategorien wiederverwendet werden.') }}</small>
|
|
</div>
|
|
</div>
|
|
<h2>{{ t('categories.fields_title') }}</h2>
|
|
<p class="muted">Labels, descriptions, data types and read-only settings are managed centrally under Settings → Fields.</p>
|
|
<table class="data-table"><thead><tr><th>{{ t('common.active') }}</th><th>{{ t('categories.database_field') }}</th><th>{{ t('categories.display_name') }}</th><th>{{ t('categories.required') }}</th><th>{{ t('categories.in_list') }}</th><th>{{ t('categories.readonly') }}</th></tr></thead><tbody>
|
|
{% for definition in definitions %}{% set cfg=selected_fields.get(definition.field_name) %}
|
|
<tr><td><input class="checkbox" type="checkbox" name="active_{{definition.id}}" {% if (cfg and cfg.active) or definition.field_name == 'name' %}checked{% endif %}{% if definition.field_name == 'name' %} disabled{% endif %}></td>
|
|
<td><code>{{definition.field_name}}</code></td><td><strong>{{ t(definition.translation_key, definition.label) }}</strong>{% if definition.description %}<div class="muted">{{definition.description}}</div>{% endif %}</td>
|
|
<td><input class="checkbox" type="checkbox" name="required_{{definition.id}}" {% if (cfg and cfg.required) or definition.field_name == 'name' %}checked{% endif %}{% if definition.readonly or definition.field_name == 'name' %} disabled{% endif %}></td>
|
|
<td><input class="checkbox" type="checkbox" name="list_{{definition.id}}" {% if (cfg and cfg.show_in_list) or definition.field_name == 'name' %}checked{% endif %}></td>
|
|
<td>{{ t('common.yes') if definition.readonly else t('common.no') }}</td></tr>{% endfor %}</tbody></table>
|
|
<button>💾 {{ t('common.save') }}</button></form>
|
|
{% endblock %}
|