Add a Font Awesome icon gallery to the properties panel, draggable onto the screen
New "Icône" widget (<i class="...">, color/size customizable exactly like any other widget) plus a curated set of ~250 verified Font Awesome 5 Free solid icon names (fontawesome_icons.py) — not the full ~1500-icon catalog, since an embedded list needs to be guaranteed accurate (a wrong class name silently renders as a blank glyph); any other valid FA5 class still works by typing it directly into the widget's "Icône" setting. The gallery lives in the (now always-visible) top of the right floating panel, searchable, with each tile both clickable and HTML5-draggable onto the canvas — either action posts to element_add with the chosen icon_class, which now seeds the new element's class instead of leaving it on the generic default. Available in the element-type template editor too, since it reuses screen_edit.html. Loads Font Awesome 5.15.4 (cdnjs) alongside the existing animate.css/Bulma links, in both the editor and /play. Verified end to end: gallery renders with real icon glyphs, clicking/simulated-drop creates a correctly-classed <i> element, and the actual /play route renders it with Font Awesome loaded. Full suite green (89).
This commit is contained in:
@@ -17,4 +17,11 @@ def element_add(slug, screen_id):
|
||||
et = types.get(int(element_type_id))
|
||||
widget = et["default_widget"] if et else "conteneur"
|
||||
new_id = screens.add_element(slug, screen_id, widget, element_type_id)
|
||||
icon_class = request.form.get("icon_class")
|
||||
if widget == "icone" and icon_class:
|
||||
# Posé depuis la galerie d'icônes (voir le panneau de propriétés,
|
||||
# section "Icônes") : la classe Font Awesome choisie remplace celle
|
||||
# posée par défaut à la création plutôt que de repartir d'une icône
|
||||
# neutre que l'utilisateur devrait ensuite retaper à la main.
|
||||
screens.save_element_controls(slug, new_id, {"ctrl_icon_class": icon_class})
|
||||
return redirect(url_for("screen_edit", slug=slug, screen_id=screen_id, selected=new_id))
|
||||
|
||||
Reference in New Issue
Block a user