|
| 1 | +# Refactoring Plan: Transition to `plone.tiles` |
| 2 | + |
| 3 | +**Goal**: Replace the custom "Row Type" logic with a standardized Tile-based approach while maintaining independent workflows and publication dates for each row. |
| 4 | + |
| 5 | +## 1. Architecture Summary |
| 6 | +- **Data Model**: Keep **Dexterity Objects** as "Row" containers to preserve workflows and permissions. |
| 7 | +- **Persistence**: Layout settings (width, spacing, etc.) and content (text, links) move into **Persistent Tile Data** (Annotations). |
| 8 | +- **Types**: Move from one generic `DynamicPageRow` to **specific content types** (e.g., `TextRow`, `SliderRow`, `FeaturedRow`). |
| 9 | +- **Rendering**: Each row type will have its corresponding **Tile** registered as its **Default View**. |
| 10 | +- **UI**: Custom "Plus" button menu updated to create these specific types and use standard `@@edit-tile` forms. |
| 11 | + |
| 12 | +## 2. Technical Components |
| 13 | + |
| 14 | +### A. Tiles & Schemas |
| 15 | +- **Base Layout Schema**: Defines common settings (Row width, Vertical spacing, Extra CSS classes). |
| 16 | +- **Specific Schemas**: Each functionality (Text, Slider, Gallery) gets its own schema with specific fields. |
| 17 | +- **Persistent Tiles**: Python classes that handle fetching data from annotations and rendering the template. |
| 18 | +- **Bootstrap Wrappers**: Tiles are "self-contained," templates render the `<div class="col-md-X">` wrappers based on their own configuration. |
| 19 | + |
| 20 | +### B. Dexterity Types |
| 21 | +- New FTIs (Factory Type Information) for each row variant. |
| 22 | +- Set the `default_view` of these FTIs to the corresponding Tile name. |
| 23 | + |
| 24 | +### C. Main Page View |
| 25 | +- `DynamicView` simplified to render the row objects, allowing Plone's `default_view` mechanism to invoke the Tiles. |
| 26 | + |
| 27 | +### D. Editing & Add Logic |
| 28 | +- Update custom JS offcanvas menu to create the correct row type in the background. |
| 29 | +- Redirect "Edit" button to `context/@@edit-tile/tile.name/default`. |
| 30 | + |
| 31 | +## 3. Implementation Steps |
| 32 | +1. **Tile Setup**: Create the `tiles` package and define the base `ITileLayoutSchema`. |
| 33 | +2. **Schema Migration**: Port current behavior fields into Tile schemas. |
| 34 | +3. **Tile Implementation**: Create the `.py` classes and `.pt` templates. |
| 35 | +4. **Registration**: Register tiles in ZCML and define new Dexterity types. |
| 36 | +5. **UI Updates**: Modify Bootstrap offcanvas and JS for new workflow. |
| 37 | +6. **Migration Script**: Upgrade step to convert existing `DynamicPageRow` objects and migrate data. |
| 38 | + |
| 39 | +## 4. Verification |
| 40 | +- **Unit Tests**: Verify Tile data persistence. |
| 41 | +- **Functional Tests**: Verify `@@edit-tile` form updates rendering. |
| 42 | +- **Integration**: Confirm "Add Row" menu creates new types. |
0 commit comments