New widget where each tab is a real "conteneur" element posed as a child (see screens/elements/add_tab.py) — this reuses everything that already exists for a normal container (adding a Répéteur/Conteneur/etc. inside via "Ajouter DANS ce conteneur", renaming to change the tab's visible label, deleting via the standard trash icon) instead of inventing a separate storage format for tabs. The widget's own properties panel gets a dedicated "Onglets" section to add a tab, rename one, jump to its content, or delete it. Rendering (render_onglets.py) builds a tab bar + one panel per tab, switched client-side (forgeShowTab, in both screen_edit.html and play.html) with only one panel visible at a time. Distinct from the existing "activer_onglet" flow action (2.3, manual show-one/hide-siblings) — that stays available for custom show/hide wiring; this widget is the turnkey version with tab management built in. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
15 lines
471 B
Python
15 lines
471 B
Python
from flask import redirect, url_for, abort
|
|
|
|
import screens
|
|
|
|
from core.flask_app import app
|
|
|
|
|
|
@app.route("/game/<slug>/elements/<int:element_id>/tabs/add", methods=["POST"])
|
|
def element_tab_add(slug, element_id):
|
|
onglets = screens.get_element(slug, element_id)
|
|
if not onglets:
|
|
abort(404)
|
|
screens.add_tab(slug, element_id, onglets["screen_id"])
|
|
return redirect(url_for("screen_edit", slug=slug, screen_id=onglets["screen_id"], selected=element_id))
|