Loads Bulma 1.0.2 in base.html (data-theme="dark" for its native dark palette) for every page that extends it, plus play.html directly. Converts every admin template — index, game dashboard, screens list, element types, object new/edit, data form/list — to real Bulma markup: navbar, breadcrumb component, box/card, field/control/input/select, table, notification, buttons, and a native Bulma modal for the data-row detail popup. Forge's own style.css keeps only what Bulma doesn't cover (the fixed-viewport builder/object-edit layouts, the element tree, canvas, flow-graph editor) and now acts as a secondary/override layer rather than a competing design system, matching how per-element inline customization already overrides widget defaults. screen_edit.html (the 3-panel screen builder) gets the same navbar/breadcrumb/button treatment plus its top rename form, but its flow-graph node editor, canvas and element tree keep their existing custom styling — several of their inputs have JS relying on exact DOM sibling structure (e.g. slider oninput reading nextElementSibling) or Bulma's own select/wrapper requirement, and reskinning them without a browser to verify against risked silently breaking the app's most complex feature. Buttons and headings there are still fully converted (safe, purely additive class changes). Verified: full test suite green, every route smoke-rendered 200 OK via the test client after the change.
115 lines
4.3 KiB
HTML
115 lines
4.3 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}{{ definition.name }} — {{ game.name }}{% endblock %}
|
|
{% block breadcrumb %}
|
|
<li><a href="{{ url_for('game_dashboard', slug=game.slug) }}">{{ game.name }}</a></li>
|
|
<li class="is-active"><a>{{ definition.name }}</a></li>
|
|
{% endblock %}
|
|
{% block content %}
|
|
<h1 class="title">{{ definition.name }}
|
|
<a class="button is-small" href="{{ url_for('object_edit', slug=game.slug, definition_id=definition.id) }}" title="Modifier cet objet">✏️</a>
|
|
</h1>
|
|
<p class="help mb-4">Table SQL : {{ definition.table_name }} — {{ definition.fields|length }} champ(s)</p>
|
|
|
|
{% if referenced_by %}
|
|
<div class="notification is-warning is-light">
|
|
⚠️ D'autres objets ont une relation vers « {{ definition.name }} » :
|
|
{{ referenced_by|map(attribute='name')|join(', ') }}.
|
|
La suppression de cet objet est bloquée tant que ces relations existent.
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if blocked_row_id %}
|
|
<div class="notification is-warning is-light">
|
|
⚠️ Impossible de supprimer l'entrée #{{ blocked_row_id }} : elle est référencée par
|
|
{% for ref in blocked_row_refs %}{{ ref.count }} entrée(s) de « {{ ref.definition_name }} » (champ « {{ ref.field_name }} »){% if not loop.last %}, {% endif %}{% endfor %}.
|
|
Modifie ou supprime d'abord ces entrées.
|
|
</div>
|
|
{% endif %}
|
|
|
|
<a class="button is-primary is-outlined mb-4" href="{{ url_for('data_new', slug=game.slug, definition_id=definition.id) }}">+ Ajouter une entrée</a>
|
|
|
|
<h2 class="subtitle">Données enregistrées</h2>
|
|
{% if rows %}
|
|
{% macro row_field_display(f, r) %}
|
|
{%- if f.type == 'relation' -%}
|
|
{{ relation_labels.get(f.id, {}).get(r[(f.name|colname) ~ '_id'], '—') }}
|
|
{%- elif f.type == 'booleen' -%}
|
|
{{ 'Oui' if r[f.name|colname] else 'Non' }}
|
|
{%- else -%}
|
|
{{ r[f.name|colname] }}
|
|
{%- endif -%}
|
|
{% endmacro %}
|
|
<div class="table-container">
|
|
<table class="table is-fullwidth is-hoverable dataTable">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
{% for f in definition.fields %}<th>{{ f.name }}</th>{% endfor %}
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for r in rows %}
|
|
<tr>
|
|
<td>{{ r.id }}</td>
|
|
{% for f in definition.fields %}
|
|
<td>{{ row_field_display(f, r) }}</td>
|
|
{% endfor %}
|
|
<td>
|
|
<div class="buttons is-inline-flex are-small">
|
|
<button type="button" class="button is-small" title="Voir cette entrée en détail" onclick="openRowDetail({{ r.id }})">👁️</button>
|
|
<a class="button is-small" href="{{ url_for('data_edit', slug=game.slug, definition_id=definition.id, row_id=r.id) }}">✏️</a>
|
|
<form method="post" action="{{ url_for('data_delete', slug=game.slug, definition_id=definition.id, row_id=r.id) }}"
|
|
onsubmit="return confirm('Supprimer définitivement l\'entrée #{{ r.id }} ?');">
|
|
<button type="submit" class="button is-small is-danger">🗑️</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{% for r in rows %}
|
|
<div class="modal" id="rowDetail{{ r.id }}">
|
|
<div class="modal-background" onclick="closeRowDetail({{ r.id }})"></div>
|
|
<div class="modal-card">
|
|
<header class="modal-card-head">
|
|
<p class="modal-card-title">Entrée #{{ r.id }}</p>
|
|
<button class="delete" aria-label="Fermer" onclick="closeRowDetail({{ r.id }})"></button>
|
|
</header>
|
|
<section class="modal-card-body">
|
|
{% for f in definition.fields %}
|
|
<div class="rowDetailField">
|
|
<div class="rowDetailLabel">{{ f.name }}</div>
|
|
<div class="rowDetailValue">{{ row_field_display(f, r) }}</div>
|
|
</div>
|
|
{% endfor %}
|
|
</section>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<p class="help">Aucune donnée enregistrée pour l'instant.</p>
|
|
{% endif %}
|
|
|
|
<script>
|
|
function openRowDetail(id) {
|
|
var modal = document.getElementById('rowDetail' + id);
|
|
if (modal) modal.classList.add('is-active');
|
|
}
|
|
function closeRowDetail(id) {
|
|
var modal = document.getElementById('rowDetail' + id);
|
|
if (modal) modal.classList.remove('is-active');
|
|
}
|
|
if (!window.__forgeRowDetailEscBound) {
|
|
window.__forgeRowDetailEscBound = true;
|
|
document.addEventListener('keydown', function (e) {
|
|
if (e.key !== 'Escape') return;
|
|
document.querySelectorAll('.modal.is-active').forEach(function (m) { m.classList.remove('is-active'); });
|
|
});
|
|
}
|
|
</script>
|
|
{% endblock %}
|