Follow-up to the previous commit per explicit feedback: three preset buttons weren't what was asked for - the ask was to grab the label in the live preview and drag it directly. Swaps app_settings.gallery_card_text_align (ENUM left/center/right, one commit old) for gallery_card_text_x (TINYINT UNSIGNED 0-100, same default position as before at 0). A discrete enum can't represent a free-dragged position, so this is a real column replacement via migration_gallery_card_drag.sql (drops the old column outright rather than keeping both, since the old one is a single commit old and unlikely to hold any real per-site customization yet). The label is now positioned with `left: X%; transform: translateX(-X%)` instead of a text-align class - the standard CSS trick for interpolating a single percentage continuously between flush-left (X=0) and flush-right (X=100, shifted back by its own width) with X=50 centering it, so dragging feels continuous rather than snapping between three fixed states. hifi-src/src/utils/galleryCardAlign.js now exports a style-computing function instead of a class lookup table. WebsiteSettings.jsx's preview label is draggable via Pointer Events (setPointerCapture on pointerdown, so tracking keeps working even if the cursor leaves the element mid-drag) with the card's own getBoundingClientRect() converting cursor position to a 0-100 percent. Kept small Links/Mittig/Rechts buttons as a secondary quick-jump alongside the drag, not instead of it. Verified against the local database directly via PHP CLI: default comes back as 0, and an arbitrary value (73) written directly to the column round-trips correctly through SiteSettingsController::show(). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
15 lines
999 B
SQL
15 lines
999 B
SQL
USE hifi_shop;
|
|
|
|
-- Ersetzt die feste links/mittig/rechts-Auswahl (gallery_card_text_align, siehe
|
|
-- migration_gallery_card_align.sql) durch eine frei per Drag & Drop einstellbare
|
|
-- horizontale Position (0 = ganz links, 50 = mittig, 100 = ganz rechts). Die alte
|
|
-- Spalte war erst wenige Commits alt und hat auf einer echten Seite vermutlich noch
|
|
-- keinen individuell gesetzten Wert - deshalb direkt ersetzt statt beide parallel zu pflegen.
|
|
-- Hinweis: Auf der Live-Seite reicht stattdessen ein Klick auf "Datenbankstruktur aktualisieren"
|
|
-- unter Admin-Panel -> Einstellungen -> Datenbank (legt die neue Spalte an, lässt die alte
|
|
-- aber automatisch/additiv stehen - siehe DEPLOY.md/SchemaController: der Button loescht nie
|
|
-- eine bestehende Spalte, nur die manuelle .sql-Route hier tut das explizit).
|
|
|
|
ALTER TABLE app_settings
|
|
DROP COLUMN IF EXISTS gallery_card_text_align,
|
|
ADD COLUMN IF NOT EXISTS gallery_card_text_x TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER package_wheel_hint_interval;
|