feat: add vendor dropdown and show_in_legal to content page editor
- Load vendors dynamically in content page editor dropdown - Add show_in_legal field to default content pages seed script - Set privacy and terms pages to show_in_legal=true, show_in_footer=false - Update page creation in seed script to use show_in_legal 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -90,12 +90,16 @@
|
||||
<select
|
||||
x-model="form.vendor_id"
|
||||
class="w-full px-3 py-2 text-gray-700 dark:text-gray-300 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:border-purple-500 dark:bg-gray-700"
|
||||
:disabled="loadingVendors"
|
||||
>
|
||||
<option :value="null">Platform Default</option>
|
||||
<!-- TODO: Load vendors dynamically if needed -->
|
||||
<template x-for="vendor in vendors" :key="vendor.id">
|
||||
<option :value="vendor.id" x-text="vendor.name"></option>
|
||||
</template>
|
||||
</select>
|
||||
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
|
||||
Platform defaults are shown to all vendors
|
||||
<span x-show="!form.vendor_id">Platform defaults are shown to all vendors</span>
|
||||
<span x-show="form.vendor_id">This page will only be visible for the selected vendor</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -362,8 +362,9 @@ DEFAULT_PAGES = [
|
||||
""",
|
||||
"meta_description": "Learn how we collect, use, and protect your personal information",
|
||||
"meta_keywords": "privacy, data protection, security, policy",
|
||||
"show_in_footer": True,
|
||||
"show_in_footer": False,
|
||||
"show_in_header": False,
|
||||
"show_in_legal": True,
|
||||
"display_order": 6,
|
||||
},
|
||||
{
|
||||
@@ -446,8 +447,9 @@ DEFAULT_PAGES = [
|
||||
""",
|
||||
"meta_description": "Read our terms of service governing the use of our platform",
|
||||
"meta_keywords": "terms, conditions, legal, agreement",
|
||||
"show_in_footer": True,
|
||||
"show_in_footer": False,
|
||||
"show_in_header": False,
|
||||
"show_in_legal": True,
|
||||
"display_order": 7,
|
||||
},
|
||||
]
|
||||
@@ -497,8 +499,9 @@ def create_default_pages(db: Session) -> None:
|
||||
meta_keywords=page_data["meta_keywords"],
|
||||
is_published=True,
|
||||
published_at=datetime.now(UTC),
|
||||
show_in_footer=page_data["show_in_footer"],
|
||||
show_in_footer=page_data.get("show_in_footer", True),
|
||||
show_in_header=page_data.get("show_in_header", False),
|
||||
show_in_legal=page_data.get("show_in_legal", False),
|
||||
display_order=page_data["display_order"],
|
||||
created_at=datetime.now(UTC),
|
||||
updated_at=datetime.now(UTC),
|
||||
|
||||
@@ -31,7 +31,9 @@ function contentPageEditor(pageId) {
|
||||
display_order: 0,
|
||||
vendor_id: null
|
||||
},
|
||||
vendors: [],
|
||||
loading: false,
|
||||
loadingVendors: false,
|
||||
saving: false,
|
||||
error: null,
|
||||
successMessage: null,
|
||||
@@ -48,6 +50,9 @@ function contentPageEditor(pageId) {
|
||||
}
|
||||
window._contentPageEditInitialized = true;
|
||||
|
||||
// Load vendors for dropdown
|
||||
await this.loadVendors();
|
||||
|
||||
if (this.pageId) {
|
||||
// Edit mode - load existing page
|
||||
contentPageEditLog.group('Loading page for editing');
|
||||
@@ -61,6 +66,23 @@ function contentPageEditor(pageId) {
|
||||
contentPageEditLog.info('=== CONTENT PAGE EDITOR INITIALIZATION COMPLETE ===');
|
||||
},
|
||||
|
||||
// Load vendors for dropdown
|
||||
async loadVendors() {
|
||||
this.loadingVendors = true;
|
||||
try {
|
||||
contentPageEditLog.info('Loading vendors...');
|
||||
const response = await apiClient.get('/admin/vendors?is_active=true&limit=100');
|
||||
const data = response.data || response;
|
||||
this.vendors = data.items || data || [];
|
||||
contentPageEditLog.info(`Loaded ${this.vendors.length} vendors`);
|
||||
} catch (err) {
|
||||
contentPageEditLog.error('Error loading vendors:', err);
|
||||
this.vendors = [];
|
||||
} finally {
|
||||
this.loadingVendors = false;
|
||||
}
|
||||
},
|
||||
|
||||
// Load existing page
|
||||
async loadPage() {
|
||||
this.loading = true;
|
||||
|
||||
Reference in New Issue
Block a user