Skip to content

Commit 34a1ad3

Browse files
committed
add refactoring plan
1 parent ef97952 commit 34a1ad3

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

docs/refactoring_plan.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Refactoring Plan: Separate Dexterity Content Types for cs_dynamicpages
2+
3+
## Goal
4+
Replace the current "God-object" pattern (`DynamicPageRow`) with separate, specific Dexterity content types to improve maintainability, eliminate complex field-toggling JavaScript, and leverage standard Plone features like workflows and schemas.
5+
6+
## Proposed New Structure
7+
8+
### 1. Row Types (Added to DynamicPageFolder)
9+
- **TitleDescriptionRow**: Simple row with title and description.
10+
- **FeaturedRow**: Row with image and link.
11+
- **FeaturedOverlayRow**: Row with image as background and text overlay.
12+
- **HorizontalRuleRow**: Simple horizontal line.
13+
- **SpacerRow**: Adjustable vertical space.
14+
- **SliderRow**: Container for Slider Items.
15+
- **FeaturesRow**: Container for Feature Cards.
16+
- **AccordionRow**: Container for Accordion Items.
17+
- **QueryColumnsRow**: Row that pulls content via a Collection query.
18+
- **TextRow**: Rich Text row.
19+
20+
### 2. Item Types (Added to specific Rows)
21+
- **SliderItem**: Allowed only in `SliderRow`.
22+
- **FeatureItem**: Allowed only in `FeaturesRow`.
23+
- **AccordionItem**: Allowed only in `AccordionRow`.
24+
25+
## Step-by-Step Implementation
26+
27+
### Phase 1: Architectural Scaffolding
28+
- [ ] Define base interfaces in `src/cs_dynamicpages/interfaces.py` (`IDynamicRow`, `IDynamicItem`).
29+
- [ ] Refactor existing classes in `src/cs_dynamicpages/content/` to provide common base logic.
30+
31+
### Phase 2: Content Type Definitions
32+
- [ ] Create FTI XML files for all new Row and Item types in `src/cs_dynamicpages/profiles/default/types/`.
33+
- [ ] Register new types in `types.xml`.
34+
- [ ] Configure `allowed_content_types` to enforce the strict hierarchy.
35+
36+
### Phase 3: Behaviors & Schema
37+
- [ ] Map shared behaviors (`IRowWidth`, `IRowVerticalSpacing`, etc.) to the new types.
38+
- [ ] Ensure specific fields for each type are defined in their respective schemas/interfaces.
39+
40+
### Phase 4: View & Template Mapping
41+
- [ ] Register default `view` for each new type in `src/cs_dynamicpages/views/configure.zcml`.
42+
- [ ] Reuse existing Page Templates.
43+
- [ ] Clean up View classes from `row_type` logic.
44+
45+
### Phase 5: Cleanup
46+
- [ ] Deprecate old `DynamicPageRow` types.
47+
- [ ] Update or disable the JS field-toggling logic for new types.
48+
- [ ] Update control panel documentation.
49+
50+
## Success Criteria
51+
- [ ] All new types are addable in the correct locations.
52+
- [ ] Schemas show only relevant fields without JS intervention.
53+
- [ ] Existing views work correctly with new types.
54+
- [ ] `make test` passes.

0 commit comments

Comments
 (0)