refactor: migrate templates and static files to self-contained modules
Templates Migration: - Migrate admin templates to modules (tenancy, billing, monitoring, marketplace, etc.) - Migrate vendor templates to modules (tenancy, billing, orders, messaging, etc.) - Migrate storefront templates to modules (catalog, customers, orders, cart, checkout, cms) - Migrate public templates to modules (billing, marketplace, cms) - Keep shared templates in app/templates/ (base.html, errors/, partials/, macros/) - Migrate letzshop partials to marketplace module Static Files Migration: - Migrate admin JS to modules: tenancy (23 files), core (5 files), monitoring (1 file) - Migrate vendor JS to modules: tenancy (4 files), core (2 files) - Migrate shared JS: vendor-selector.js to core, media-picker.js to cms - Migrate storefront JS: storefront-layout.js to core - Keep framework JS in static/ (api-client, utils, money, icons, log-config, lib/) - Update all template references to use module_static paths Naming Consistency: - Rename static/platform/ to static/public/ - Rename app/templates/platform/ to app/templates/public/ - Update all extends and static references Documentation: - Update module-system.md with shared templates documentation - Update frontend-structure.md with new module JS organization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,8 +50,8 @@ app/
|
||||
**Purpose:** Public-facing platform pages (marketing, info pages)
|
||||
|
||||
**Location:**
|
||||
- Templates: `app/templates/platform/`
|
||||
- Static: `static/platform/`
|
||||
- Templates: `app/templates/public/`
|
||||
- Static: `static/public/`
|
||||
|
||||
**Pages:**
|
||||
- Homepage (multiple layouts: default, minimal, modern)
|
||||
@@ -163,7 +163,7 @@ app/
|
||||
|
||||
Each frontend has its own static directory for frontend-specific assets. Use the appropriate directory based on which frontend the asset belongs to.
|
||||
|
||||
### Platform Static Assets (`static/platform/`)
|
||||
### Platform Static Assets (`static/public/`)
|
||||
|
||||
**JavaScript Files:**
|
||||
```html
|
||||
@@ -270,7 +270,7 @@ Each frontend has its own static directory for frontend-specific assets. Use the
|
||||
Icon system (used by all 4 frontends) → static/shared/js/icons.js
|
||||
Admin dashboard chart → static/admin/js/charts.js
|
||||
Vendor product form → static/vendor/js/product-form.js
|
||||
Platform hero image → static/platform/img/hero.jpg
|
||||
Platform hero image → static/public/img/hero.jpg
|
||||
Storefront product carousel → static/storefront/js/carousel.js
|
||||
```
|
||||
|
||||
@@ -338,31 +338,18 @@ app.mount("/static/modules/orders", StaticFiles(directory="app/modules/orders/st
|
||||
| **marketplace** | marketplace*.js, letzshop*.js | letzshop.js, marketplace.js, onboarding.js | - |
|
||||
| **monitoring** | monitoring.js, background-tasks.js, imports.js, logs.js | - | - |
|
||||
| **dev_tools** | testing-*.js, code-quality-*.js, icons-page.js, components.js | - | - |
|
||||
| **cms** | content-pages.js, content-page-edit.js | content-pages.js, content-page-edit.js, media.js | - |
|
||||
| **cms** | content-pages.js, content-page-edit.js | content-pages.js, content-page-edit.js, media.js | media-picker.js |
|
||||
| **analytics** | - | analytics.js | - |
|
||||
| **tenancy** | companies*.js, vendors*.js, platforms*.js, admin-users*.js, users*.js | login.js, team.js, profile.js, settings.js | - |
|
||||
| **core** | dashboard.js, settings.js, my-menu-config.js, login.js, init-alpine.js | dashboard.js, init-alpine.js | vendor-selector.js |
|
||||
|
||||
### Platform Static Files (Not in Modules)
|
||||
|
||||
These files remain in `static/` because they're platform-level, not module-specific:
|
||||
Only framework-level files remain in `static/`:
|
||||
|
||||
**Admin Core (`static/admin/js/`):**
|
||||
- `init-alpine.js` - Admin layout initialization
|
||||
- `dashboard.js` - Main admin dashboard
|
||||
- `login.js` - Admin authentication
|
||||
- `platforms.js`, `platform-*.js` - Platform management (6 files)
|
||||
- `vendors.js`, `vendor-*.js` - Vendor management at platform level (6 files)
|
||||
- `companies.js`, `company-*.js` - Company management (3 files)
|
||||
- `admin-users.js`, `admin-user-*.js` - Admin user management (3 files)
|
||||
- `users.js`, `user-*.js` - Platform user management (4 files)
|
||||
- `settings.js` - Platform settings
|
||||
|
||||
**Vendor Core (`static/vendor/js/`):**
|
||||
- `init-alpine.js` - Vendor layout initialization
|
||||
- `dashboard.js` - Vendor main dashboard
|
||||
- `login.js` - Vendor authentication
|
||||
- `profile.js` - Vendor account settings
|
||||
- `settings.js` - Vendor configuration
|
||||
- `team.js` - Team member management
|
||||
**Admin Framework (`static/admin/js/`):**
|
||||
- `module-config.js` - Module system configuration UI
|
||||
- `module-info.js` - Module information display
|
||||
|
||||
**Shared Utilities (`static/shared/js/`):**
|
||||
- `api-client.js` - Core HTTP client with auth
|
||||
@@ -370,8 +357,7 @@ These files remain in `static/` because they're platform-level, not module-speci
|
||||
- `money.js` - Money/currency handling
|
||||
- `icons.js` - Heroicons SVG definitions
|
||||
- `log-config.js` - Centralized logging
|
||||
- `vendor-selector.js` - Vendor autocomplete component
|
||||
- `media-picker.js` - Media picker component
|
||||
- `lib/` - Third-party libraries (Alpine.js, Chart.js, etc.)
|
||||
|
||||
### User Type Distinction
|
||||
|
||||
@@ -379,13 +365,13 @@ The codebase distinguishes between three types of users:
|
||||
|
||||
| Type | Management JS | Location | Description |
|
||||
|------|---------------|----------|-------------|
|
||||
| **Admin Users** | admin-users.js | `static/admin/js/` | Platform administrators (super admins, platform admins) |
|
||||
| **Platform Users** | users.js | `static/admin/js/` | Vendor/company users who log into the platform |
|
||||
| **Admin Users** | admin-users.js | `app/modules/tenancy/static/admin/js/` | Platform administrators (super admins, platform admins) |
|
||||
| **Platform Users** | users.js | `app/modules/tenancy/static/admin/js/` | Vendor/company users who log into the platform |
|
||||
| **Shop Customers** | customers.js | `app/modules/customers/static/` | End customers who buy from vendors |
|
||||
|
||||
This distinction is important:
|
||||
- `admin-users.js` and `users.js` manage **internal platform users** → Stay in `static/admin/js/`
|
||||
- `customers.js` manages **storefront customers** → Lives in the customers module
|
||||
All user management JS is now in self-contained modules:
|
||||
- `admin-users.js` and `users.js` are in the **tenancy** module (manages platform users)
|
||||
- `customers.js` is in the **customers** module (manages storefront customers)
|
||||
|
||||
---
|
||||
|
||||
@@ -466,7 +452,7 @@ All frontends communicate with backend via APIs:
|
||||
- `/api/v1/admin/*` - Admin APIs
|
||||
- `/api/v1/vendor/*` - Vendor APIs
|
||||
- `/api/v1/storefront/*` - Storefront APIs
|
||||
- `/api/v1/platform/*` - Platform APIs
|
||||
- `/api/v1/public/*` - Platform APIs
|
||||
|
||||
**Benefits:**
|
||||
- Clear backend contracts
|
||||
|
||||
Reference in New Issue
Block a user