4.9 KiB
Epic 5: Posts/Blog System
Epic Goal
Implement an admin-only content publishing system for legal updates, articles, and news that is publicly visible to all website visitors.
Epic Description
Business Context
The lawyer needs to publish professional legal content to establish expertise and keep visitors informed. Posts are created by admin only, displayed publicly without login requirement, and support bilingual content (Arabic/English).
Technical Context
- Publishing: Admin-only creation
- Visibility: Public (no login required)
- Content: Text-only with rich text formatting
- Interaction: Read-only (no comments)
- Search: Simple title and body search
Success Criteria
- Admin can create, edit, delete posts
- Rich text editor for formatting
- Draft saving capability
- Posts publicly visible
- Search functionality
- Reverse chronological display
- Bilingual content support
- Responsive design
Stories
Story 5.1: Post Creation & Editing
Description: Allow admin to create and edit blog posts with rich text formatting.
Acceptance Criteria:
- Create post form with:
- Title (required, bilingual: Arabic and English)
- Body content (required, bilingual)
- Status (draft/published)
- Rich text editor for body:
- Bold, italic, underline
- Headings (H2, H3)
- Bullet and numbered lists
- Links
- Blockquotes
- Save as draft functionality
- Preview post before publishing
- Edit published posts
- Auto-save draft periodically
- Immediate publishing (no scheduling)
- Timestamps: created_at, updated_at
Technical Notes:
- Use TinyMCE or similar rich text editor
- Store bilingual content (title_ar, title_en, body_ar, body_en)
- Or use JSON column for translations
Story 5.2: Post Management Dashboard
Description: Admin interface to manage all posts.
Acceptance Criteria:
- List all posts with:
- Title (in current admin language)
- Status (draft/published)
- Created date
- Last updated date
- Filter by status (draft/published/all)
- Search by title or body content
- Sort by date (newest/oldest)
- Quick actions:
- Edit
- Delete (with confirmation)
- Publish/unpublish toggle
- Pagination for large post counts
- Bulk delete option
Technical Notes:
- Use Livewire for real-time filtering
- Soft delete consideration (or hard delete per PRD)
Story 5.3: Post Deletion
Description: Allow admin to permanently delete posts.
Acceptance Criteria:
- Delete button on post list and edit page
- Confirmation dialog before deletion
- Permanent deletion (no soft delete)
- Success message after deletion
- Cannot delete while viewing post publicly
- Audit log entry for deletion
Technical Notes:
- Hard delete from posts table
- Log in admin_logs for audit
Story 5.4: Public Posts Display
Description: Display published posts to all website visitors.
Acceptance Criteria:
- Posts listing page (public, no login required)
- Display in reverse chronological order
- Each post card shows:
- Title
- Publication date
- Excerpt (first ~150 characters)
- Read more link
- Individual post page with full content
- Clean, readable typography
- Responsive design (mobile-friendly)
- Language-appropriate content based on site language
- Back to posts list link
- Pagination for post list
Technical Notes:
- Display title/body based on current locale
- No authentication required
- SEO-friendly URLs (optional, per PRD no SEO for now)
Story 5.5: Post Search
Description: Allow visitors to search through published posts.
Acceptance Criteria:
- Search input on posts listing page
- Search by:
- Title (both languages)
- Body content (both languages)
- Real-time search results (debounced)
- Search highlights in results (optional)
- "No results found" message
- Clear search button
- Search works in both Arabic and English
- Only searches published posts
Technical Notes:
- Use Livewire for real-time search
- LIKE query on title and body fields
- Consider full-text search for performance (future)
Dependencies
| Epic | Dependency |
|---|---|
| Epic 1 | Base UI, navigation, bilingual support |
Risks & Mitigations
| Risk | Impact | Mitigation |
|---|---|---|
| Rich text editor XSS | High | Sanitize HTML, whitelist allowed tags |
| Large content performance | Low | Paginate, excerpt for listings |
| Draft loss on browser crash | Medium | Auto-save functionality |
Definition of Done
- All stories completed with acceptance criteria met
- Tests for post CRUD operations
- Tests for public display
- Tests for search functionality
- Rich text properly sanitized
- Bilingual content working
- Responsive design verified
- Code formatted with Pint