feat: add show_in_legal to admin content page editor
- Add "Show in Legal" checkbox to content page editor UI - Update API schemas (ContentPageCreate, ContentPageUpdate, ContentPageResponse) - Add show_in_legal parameter to service methods (create_page, update_page, etc.) - Fix ContentPageNotFoundException to pass identifier correctly - Fix UnauthorizedContentPageAccessException to use correct AuthorizationException API - Add comprehensive unit tests for ContentPageService (35 tests) - Add content page fixtures for testing - Update CMS documentation with navigation categories diagram 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,10 +67,11 @@ CREATE TABLE content_pages (
|
||||
is_published BOOLEAN DEFAULT FALSE NOT NULL,
|
||||
published_at TIMESTAMP WITH TIME ZONE,
|
||||
|
||||
-- Navigation
|
||||
-- Navigation placement
|
||||
display_order INTEGER DEFAULT 0,
|
||||
show_in_footer BOOLEAN DEFAULT TRUE,
|
||||
show_in_header BOOLEAN DEFAULT FALSE,
|
||||
show_in_footer BOOLEAN DEFAULT TRUE, -- Quick Links column
|
||||
show_in_header BOOLEAN DEFAULT FALSE, -- Top navigation
|
||||
show_in_legal BOOLEAN DEFAULT FALSE, -- Bottom bar with copyright
|
||||
|
||||
-- Timestamps
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
|
||||
@@ -105,7 +106,9 @@ POST /api/v1/admin/content-pages/platform
|
||||
"content_format": "html",
|
||||
"meta_description": "Learn more about our marketplace",
|
||||
"is_published": true,
|
||||
"show_in_header": true,
|
||||
"show_in_footer": true,
|
||||
"show_in_legal": false,
|
||||
"display_order": 1
|
||||
}
|
||||
```
|
||||
@@ -217,10 +220,16 @@ Automatically uses vendor context from middleware:
|
||||
**2. Get Navigation Links**
|
||||
|
||||
```bash
|
||||
# Get all navigation pages
|
||||
GET /api/v1/shop/content-pages/navigation
|
||||
|
||||
# Filter by placement
|
||||
GET /api/v1/shop/content-pages/navigation?header_only=true
|
||||
GET /api/v1/shop/content-pages/navigation?footer_only=true
|
||||
GET /api/v1/shop/content-pages/navigation?legal_only=true
|
||||
```
|
||||
|
||||
Returns all published pages for footer/header navigation.
|
||||
Returns published pages filtered by navigation placement.
|
||||
|
||||
## File Structure
|
||||
|
||||
@@ -408,18 +417,50 @@ Always provide meta descriptions:
|
||||
|
||||
### 4. Navigation Management
|
||||
|
||||
Use `display_order` to control link ordering:
|
||||
The CMS supports three navigation placement categories:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ HEADER (show_in_header=true) │
|
||||
│ [Logo] About Us Contact [Login] [Sign Up] │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ PAGE CONTENT │
|
||||
│ │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ FOOTER (show_in_footer=true) │
|
||||
│ ┌──────────────┬──────────────┬────────────┬──────────────┐ │
|
||||
│ │ Quick Links │ Platform │ Contact │ Social │ │
|
||||
│ │ • About │ • Admin │ • Email │ • Twitter │ │
|
||||
│ │ • FAQ │ • Vendor │ • Phone │ • LinkedIn │ │
|
||||
│ │ • Contact │ │ │ │ │
|
||||
│ │ • Shipping │ │ │ │ │
|
||||
│ └──────────────┴──────────────┴────────────┴──────────────┘ │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ LEGAL BAR (show_in_legal=true) │
|
||||
│ © 2025 Wizamart Privacy Policy │ Terms │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Navigation Categories:**
|
||||
|
||||
| Category | Field | Location | Typical Pages |
|
||||
|----------|-------|----------|---------------|
|
||||
| Header | `show_in_header` | Top navigation bar | About, Contact |
|
||||
| Footer | `show_in_footer` | Quick Links column | FAQ, Shipping, Returns |
|
||||
| Legal | `show_in_legal` | Bottom bar with © | Privacy, Terms |
|
||||
|
||||
**Use `display_order` to control link ordering within each category:**
|
||||
|
||||
```python
|
||||
# Platform defaults
|
||||
"about": display_order=1
|
||||
"shipping": display_order=2
|
||||
"returns": display_order=3
|
||||
"privacy": display_order=4
|
||||
"terms": display_order=5
|
||||
|
||||
# Result in footer:
|
||||
About | Shipping | Returns | Privacy | Terms
|
||||
# Platform defaults with navigation placement
|
||||
"about": display_order=1, show_in_header=True, show_in_footer=True
|
||||
"contact": display_order=2, show_in_header=True, show_in_footer=True
|
||||
"faq": display_order=3, show_in_footer=True
|
||||
"shipping": display_order=4, show_in_footer=True
|
||||
"returns": display_order=5, show_in_footer=True
|
||||
"privacy": display_order=6, show_in_legal=True
|
||||
"terms": display_order=7, show_in_legal=True
|
||||
```
|
||||
|
||||
### 5. Content Reversion
|
||||
@@ -437,18 +478,19 @@ DELETE /api/v1/vendor/{code}/content-pages/15
|
||||
|
||||
Standard slugs to implement:
|
||||
|
||||
| Slug | Title | Description | Show in Footer |
|
||||
|------|-------|-------------|----------------|
|
||||
| `about` | About Us | Company/vendor information | Yes |
|
||||
| `contact` | Contact Us | Contact information and form | Yes |
|
||||
| `faq` | FAQ | Frequently asked questions | Yes |
|
||||
| `shipping` | Shipping Info | Shipping policies and rates | Yes |
|
||||
| `returns` | Returns | Return and refund policy | Yes |
|
||||
| `privacy` | Privacy Policy | Privacy and data protection | Yes |
|
||||
| `terms` | Terms of Service | Terms and conditions | Yes |
|
||||
| `help` | Help Center | Support resources | Yes |
|
||||
| `size-guide` | Size Guide | Product sizing information | No |
|
||||
| `careers` | Careers | Job opportunities | No |
|
||||
| Slug | Title | Header | Footer | Legal | Order |
|
||||
|------|-------|--------|--------|-------|-------|
|
||||
| `about` | About Us | ✅ | ✅ | ❌ | 1 |
|
||||
| `contact` | Contact Us | ✅ | ✅ | ❌ | 2 |
|
||||
| `faq` | FAQ | ❌ | ✅ | ❌ | 3 |
|
||||
| `shipping` | Shipping Info | ❌ | ✅ | ❌ | 4 |
|
||||
| `returns` | Returns | ❌ | ✅ | ❌ | 5 |
|
||||
| `privacy` | Privacy Policy | ❌ | ❌ | ✅ | 6 |
|
||||
| `terms` | Terms of Service | ❌ | ❌ | ✅ | 7 |
|
||||
| `help` | Help Center | ❌ | ✅ | ❌ | 8 |
|
||||
| `size-guide` | Size Guide | ❌ | ❌ | ❌ | - |
|
||||
| `careers` | Careers | ❌ | ❌ | ❌ | - |
|
||||
| `cookies` | Cookie Policy | ❌ | ❌ | ✅ | 8 |
|
||||
|
||||
## Security Considerations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user